Hacker News new | past | comments | ask | show | jobs | submit login

I think there are some quick wins that doesn't take too much dev time but makes components reusable or at least easily make it reusable in the future.

- Like you've already said, prefer splitting components into purely presentational components("dumb components") and components with some logics ("smart components")

- If you are using design components, make sure to pass on those props. e.g. if you are using Chakra, pass BoxProps to <Box>.

- try to split out logic into hooks. This can be very specific to the current use case.

These aren't hard things to do but lets you quickly create a generic component by only changing the smart component/hooks or only reuse the dumb components with another specific hook, if the use case is a bit different.




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

Search: