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.

4.x has broken render props

See original GitHub issue

Version 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:closed
  • Created 5 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
TobyEaldencommented, Mar 15, 2019

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.

0reactions
goldocommented, Apr 11, 2019

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

Read more comments on GitHub >

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

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