Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the unnecessary use of render props in the component composition example. #7

Open
Ross-Esmond opened this issue Feb 1, 2019 · 3 comments

Comments

@Ross-Esmond
Copy link

The use of render props is misguided in the Card example. Render props allow a parent component to provide data to a render without having to explicitly know what its children are. If a render prop takes no arguments it should just be swapped out for static JSX.

@Ross-Esmond
Copy link
Author

To be clear, I'm referring to the use of arrow functions to wrap the jsx. Not the passing of children into properties.

@tyroprogrammer
Copy link
Owner

I agree that in this case arrow function is not really doing anything but the goal really was to show that you can pass function as props that will return what to render. Maybe instead of getting rid of the arrow function it's better to change the exercise slightly so that the caller is passing some data to the render props!

@Ross-Esmond
Copy link
Author

Ross-Esmond commented Feb 2, 2019

Yep, and that makes since. Although I would still suggest removing the functions in favor of a simpler, more direct approach. Most of your tutorial focuses on building an understanding of the fundamentals. Which is good, because that's actually where most people struggle. I just wouldn't want someone to conflate composition with render props specifically. Composition through children passing is a strong enough tool to get a dedicated section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants