[system] Invalid PropType for Box
See original GitHub issue- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
Using Box with function as children throws a PropType warning
Warning: Failed prop type: Invalid prop `children` supplied to `ForwardRef(StyledComponent)`, expected a ReactNode.
Expected Behavior 🤔
No warning
Steps to Reproduce 🕹
https://codesandbox.io/s/goofy-glade-emf0h?file=/demo.js
<Box color="success.main">
{(props) => <span {...props}>Test function</span>}
</Box>
Context 🔦
Your Environment 🌎
Tech | Version |
---|---|
Material-UI | alpha 12 |
React | 16.8 |
Browser | |
TypeScript | 4 |
etc. |
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
[system] Invalid PropType for Box · Issue #22982 - GitHub
The issue is present in the latest release. I have searched the issues of this repository and believe that this is not a...
Read more >Warning: Failed prop type: Invalid prop `label` of type `object ...
It means you're providing the wrong type to the label prop. It only expects a string, but you're passing a react fragment. Change...
Read more >Warning: Failed prop type: Invalid prop `children` supplied to ...
Warning: Failed prop type: Invalid prop `children` supplied to `ForwardRef(Typography)`, expected a ReactNode. */<Typography key={item.id}>
Read more >How To Customize React Components with Props
PropTypes are a simple type system to check that data matches the expected types during runtime. They serve as both documentation and an ......
Read more >Typechecking With PropTypes - React
PropTypes exports a range of validators that can be used to make sure the data you receive is valid. In this example, we're...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@darkowic Yes, the above proposal comes hand-in-hand with removing the
clone
prop. The prop has been unreliable and will likely never be. It’s often used to override existing styles, however, to work correctly the styles have to be injected after in the<head>
. The order is ruled by the import order. With JSS, it only works when using 1-level imports. With emotion & styled-components, I haven’t tried but I imagine it will be as brittle.The alternative would be the introduction of the
sx
prop (same as the system) in all the core components and styles created with ourstyled
helper.Fixed in #23053 by @mnajdova