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.

Suggestion: Render props via render prop

See original GitHub issue

Hey, what do you think about adding render prop to the component for the render props pattern?

Say:

<ScrollTo render={
 (scroll) => (
    <a onClick={scroll(0, 500)}>
      Scroll to Bottom
    </a>
  } 
/>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
ganderzzcommented, Nov 21, 2017

@JikkuJose Definitely on-board with render props (Michael Jackson sold me also)!

Let’s keep to the discussion of a render prop in addition to children render prop. Unless we find a clean solution to the issues @newyork-anthonyng proposed, we should stick to just using the child prop as a function. I want to keep a small API footprint, so the less special cases, the better.

1reaction
jikkujosecommented, Nov 20, 2017

@ganderzz didn’t meant to bad mouth HoCs but somehow I am sold to render props after listening to a talk by Michael Jackson.

Have already commented on the issue, but I wonder whether its even possible!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to create a render prop component | by Sean McPherson
At its core, render prop is “a simple technique for sharing code between React components using a prop whose value is a function.”...
Read more >
An Overview of Render Props in React - CSS-Tricks
Using render props in React is a technique for efficiently re-using code. According to the React documentation, “a component with a render prop...
Read more >
React's Render Props technique in 3 Minutes - codeburst
A technique for sharing logic between components. Components accept a prop that returns a function responsible for rendering something.
Read more >
Testing ⚛️ components using render props - Kent C. Dodds
So how do you test a component that uses a render prop component? Whelp, if you're using E2E or Integration tests, you pretty...
Read more >
Suggestion to change documentation on <Route>'s render prop
Naming the render prop props as routerProps instead of props . I suggest doing that also for other examples that name the routerProps...
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