[React] Returning null from setState in React 16
Returning
nullwill not update state and trigger a component re-render
Example:
updateMocktail = mocktail => { const newMocktail = mocktail; this.setState(state => { if (state.mocktail === newMocktail) { return null; } else { return { mocktail }; } }) }

浙公网安备 33010602011771号