Hacker News new | past | comments | ask | show | jobs | submit login
Comments in React: The Good, the Bad and the Ugly (dmitripavlutin.com)
1 point by synergy20 on April 30, 2023 | hide | past | favorite | 1 comment



Or... You could define a comment component that either,

1. Always takes props but always returns null. (Useful for Todo comments that contain jsx code snippets that don't render)

2. Or, always takes children and a single comment prop, and always returns children in react fragment. (To associate specific comments with specific jsx snippets)

You could even have multiple exports for them. (I.e. Todo vs Warning vs. Comment)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: