Best of JSXAugust 2022

  1. 1
    Article
    Avatar of shopifyShopify Engineering·4y

    Mastering React’s Stable Values

    UseState and useReducer return a state update function that is constant – the hook will always return the same function. UseFocusEffect has to assume that this new function’s behavior is different and what it does (on every render) is call the cleanup function unsubscribe. The pitfall is in how we tell React to render the JSX.

  2. 2
    Article
    Avatar of logrocketLogRocket·4y

    12 essential ESLint rules for React

    ESLint has a comprehensive set of rules for JavaScript code that cover stylistic choices and prevent common bugs. The rules are discussed in detail in the React documentation, but there are two rules that must be followed when using Hooks. Action buttons that are not intended to submit a form should have a type attribute. When no type is specified, a button defaults to a type of submit. If an optional prop is not passed to a component, it will be undefined.