[Stack] Component throws error when direction prop is an array
See original GitHub issueDescribe the bug
When an array is passed to the direction
prop of Stack component, it throws TypeError direction.endsWith is not a function
. See the image below:
This is because of this line in the Stack component. Also, TS doesn’t throw an error on VSCode. See the image below:
Expected Behavior TS should throw an error that only string is accepted. Also, no error should be shown on the browser because of this.
To Reproduce
Add a Stack component and pass an array to the direction
prop. Link to the issue in CodeSandbox.
Desktop (please complete the following information):
- OS: macOS Catalina
- Browser: Chrome
- Version: 81.0.4044.138
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Passing array to props but getting error while iterating [duplicate]
The error means that props is not an array like you think it is. I cannot offer any more help than that until...
Read more >How to Read React Errors (fix 'Cannot read property of ...
This error usually means you're trying to use .map on an array, but that array isn't defined yet. That's often because the array...
Read more >Stack API - Material UI - MUI
API reference docs for the React Stack component. Learn about the props, CSS, and other APIs of this exported module. ... Array<'column-reverse' |...
Read more >Understanding the "Objects are not valid as a react child" Error ...
Inside the error, a clear rule states that JavaScript objects don't fit alongside the components, meaning that you should use the data from...
Read more >Warning: Each Child in a List Should Have a Unique 'key' Prop
It is not recommended to use the index of the array as the key prop if you know the array will not be...
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
@Ndifreke This has been fixed in 1.0. Hoping to have an alpha/beta released soon.
Got this error 😛 How do I fix it? I am on “@chakra-ui/core”: “^0.8.0”,