question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
oliviertassinaricommented, Oct 11, 2020

@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 our styled helper.

0reactions
oliviertassinaricommented, Oct 23, 2020

Fixed in #23053 by @mnajdova

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found