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.

Render prop option

See original GitHub issue

This would save some code for me:

<ReactResizeDetector render={({ width, height }) => <MyComponent width={width} />}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
natewcommented, Jun 3, 2018

It avoids needing to “setState” to store the width/height, which means no need to have a class you can just do a small function! So saves me 12 lines of code and complexity or so.

0reactions
maslianokcommented, Jun 12, 2018

@natew deployed in v3.0.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding React Render Props by Example
Render props means that you pass a render function defined by a separate component's props to indicate what should be returned by the...
Read more >
How to create a render prop component | by Sean McPherson
When Name renders, it calls props.renderProp and passes some data; in this case, a string with my name. We have designed our Name...
Read more >
React render props vs. custom Hooks - LogRocket Blog
React Hooks and render props can co-exist because they solve the same problem of moving state away from your components.
Read more >
Using the Route render prop in React - DEV Community ‍ ‍
How to pass props down to a rendered component via Route. ... The other option is to use the render prop of Route...
Read more >
React.js Render Props - GeeksforGeeks
The Render Props is a technique in ReactJS for sharing code between React components using a prop whose value is a function.
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