4.x has broken render props
See original GitHub issueVersion 4.0.1 has broken renderProps usage:
return (
<ReactResizeDetector
handleHeight
handleWidth
render={({height, width}) => (
<LineChart
width={width}
height={height - 30}
data={data}
>
...
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Answers to common questions about render props
I got quite a few great responses and for today's newsletter I thought I'd share three of them and simple examples for the...
Read more >Render Props, Why and How To Use - Dillion's Blog
Render Props is an amazing concept used in React to share code and functionality between components. In this article, we'll learn why and...
Read more >React Render Props - ui.dev
In this post you'll learn a pattern for accomplishing code reuse amongst components in a React app, Render Props.
Read more >reactjs - Why render props is not working with Curly Braces in ...
This is the problem in your broken App code: when you use curly braces, you're defining a block scope for the function's body,...
Read more >Render Props - React
For example, let's say we have a <Cat> component that renders the image of a cat chasing the mouse around the screen. We...
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
Using
skipOnMount
doesn’t help - if used in combination with default width/height it means the component will stay at that size until a manual resize occurs (e.g. 200x200 in the example above).Adding a default width and height does work but that feels like a hack to me, and it does cause a ‘flicker’ on initial render, whereas it works out-of-the box with no defaults using v3.4.
Having said that, I’m happy to stick with 3.4 as it serves my needs - so feel free to close this and thanks for your help.
Same problem here: I need to set a width for drawing my charts. Since react-resize-detector doesn’t go 100% by default with 4.x, I can’t draw my chart in one time: I need to set a default size for my chart, it draws, then resize… This use case was working with 3.X since it gave my a width in px that would match 100% of the available width.
Edit: my charts can’t take “100%” in value, it must be set in pixels