Full Stack Software Development Blog
Fortunately for me a couple of guys on my team at work are fluent in React. I asked them to do a code review and got a lot of good feedback. As a result of the feedback the step-10-code-review-refactor branch at https://github.com/gpratte/react-todo-list has the following changes
- Use .jsx extension for components
- Use lodash for better performance for map, filter, etc.
- Consider using destructuring syntax to avoid constantly referencing state or props, e.g. const { foo, bar, baz } = this.state
- Use lodash for better performance for map, filter, etc.
- Consistently use arrow methods vs regular old functions
- Count should probably be in the component state
- Unless there are things like dashes/dots, quotes are unnecessary for object keys
- With ES2015 you could use template literal for text substitution
- Spelled concatenate wrong
- Avoid creating new functions in render, this is bad for scalability as each render will create new functions that need to be garbage collected