- [CODE STYLE] - Method's name should start with a verb (so you could easily tell what your method actually do)
BAD EXAMPLE:
clickHandler = () => {
console.log('Hello, world');
}
GOOD EXAMPLE:
handleClick = () => {
console.log('Hello, world');
}
-
[CODE KNOWLEDGE] - Check if you remove your event listener, when component will unmount from page.
-
[CODE STYLE] - Readabily is everything. Format ternary operator operands correctly - move each operand to the separate line:
BAD EXAMPLE:
{condition ? 'Very important text': 'Nothing important'}
GOOD EXAMPLE:
{condition
? 'Very important text'
: 'Nothing important'
}