Error with multiple same component child
- Dominant language
- JavaScript
- Stars
- 7.1k
- Forks
- 386
- PR merge metrics
- No merged PRs in 30d
Description
__Expected behavior:__
It should not display such a warning
__Describe the bug:__
I get the warning: Warning: [JSS] Rule is not linked. Missing sheet option "link: true". when I duplicate in a component the same child component when it has a dynamic value. I am using Next SSR and have already reported the problem but I don't know where the problem is coming from.
https://github.com/vercel/next.js/issues/23872
If it only appears once it does not show the warning
Thanks ;)
__Reproduction:__
Install the example with-react-jss-app
`npx create-next-app --example with-react-jss with-react-jss-app
`
Then modify the pages/index.js to
```
import { createUseStyles } from 'react-jss'
const useStyes = createUseStyles({
header: {
color: props => props.color
}
})
const Bar = () => {
const classes = useStyes({ color: 'green' });
return (
<>
dasdasda
)
}
function Index() {
return (
Example on how to use react-jss with Next.js
)
}
export default Index
```
Run in dev mode
`npm run dev o yarn dev
`
And it will show the warning:
`Warning: [JSS] Rule is not linked. Missing sheet option "link: true".
`
__Versions (please complete the following information):__
- jss: 10.6.0
- Browser [e.g. chrome, safari]: All browsers, Occurs on the SSR server
- OS [e.g. Windows, macOS]: macOs
Contributor guide
Research direction
Start with the with-react-jss Next.js example and the modified pages/index.js reproduction, using jss 10.6.0 in SSR mode. Run the example with two Bar instances and inspect where the dynamic style warning is emitted. Done means the warning no longer appears for duplicated child components while the styles still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, next.js, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100