React - kapilpipaliya/ruby_notes GitHub Wiki
Rules
- make simple components when
- component is primitive like button, link, etc
- component is a container like Card, dropdown, Action, Table, etc
- component behavior should only be modified through props
- component should not have too many props
- break big component in smaller like Card, CardHeader, CardFooter
- component should be isolated, it should not know about children.
- Never loop through data in the component. let users of components do it. it allows users to customize children.
- component class Names should be totally customizable
- all class names can be disabled with one boolean prop
- give the option to add a custom class Name to each major HTML dom
- Always prepare class Names before rendering component
- keep CSS class Properties small