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

Chapter 10 video 119 Improving reusability with props #59

Open
LieutenantCobretti1998 opened this issue Apr 7, 2024 · 0 comments
Open

Comments

@LieutenantCobretti1998
Copy link

The StarRating component currently expects a function to be passed to the onSetRating prop. If this prop is not provided, the application throws an error when trying to execute onSetRating as it is undefined. The StarRating component should have a default behavior defined for onSetRating to avoid TypeError when the function is not provided. This will enhance the component's robustness and prevent potential runtime errors. I found this error for the movie list app in Star component. . Please check it and add this verificator for avoiding questions about it 😁

function handleRating(rating) { setRating(rating); if(onSetRating) onSetRating(rating); }

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

1 participant