stateless components: This means components that don’t have any this.state = { ... } calls in them. They only deal with incoming “props” and sub-components Anather is stateful components
- less code
- easier to understand
- stateless
- simpler to test
- no 'this' binding
- easier to extract smaller components
- Read
- Test
- Maintain
- Reuse
With ES6 classes, React does not autobind the functions inside that component.
constructor(props) {
super(props);
this.bindFn = this.bindFn.bind(this)
}
It can help prevent bugs by ensuring you are using the right data types for your props.
Google react plugin
Not all lists need to have keys. A list needs keys if either of the following are true:
-
The list-items have memory from one render to the next. For instance, when a to-do list renders, each item must "remember" whether it was checked off. The items shouldn't get amnesia when they render.
-
A list's order might be shuffled. For instance, a list of search results might be shuffled from one render to the next.