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

[Advanced React] Render Props application #75

Open
reboottime opened this issue Apr 28, 2024 · 2 comments
Open

[Advanced React] Render Props application #75

reboottime opened this issue Apr 28, 2024 · 2 comments

Comments

@reboottime
Copy link
Owner

reboottime commented Apr 28, 2024

Render Props application

This article is a note of Render props - Advanced React course, Episode 4

Major Content

@reboottime
Copy link
Owner Author

reboottime commented Apr 28, 2024

The problem and Solution

Take the button component in previous lecture as an example, where the <Icon /> component may control its size using the font-size prop. For example:

<Icon fontSize="16" />
  • This solution has two problems:

    • The previous logic for controlling the icon size fails silently
    image
    • There is no way to update the icon color based on whether the button is currently being hovered over.
  • The solution

image

@reboottime
Copy link
Owner Author

reboottime commented Apr 28, 2024

Why we still need it in these days?

  • Configuration and flexibility
  • lots of them in old codebase
  • Sometimes still useful
image
  • it can't help with performance

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

No branches or pull requests

1 participant