Uploaded image for project: 'stripes-components'
  1. stripes-components
  2. STCOM-275

Refactor away lifecycle hooks deprecated in React 17

    XMLWordPrintable

Details

    • Task
    • Status: Closed (View Workflow)
    • P3
    • Resolution: Done
    • None
    • 9.0.0
    • None
    • stripes-force 96, Firebird Sprint 99
    • 2
    • Firebird

    Description

      The following components throw lint errors because they use the deprecated React lifecycle hook, componentWillUpdate.

      componentWillUpdate is deprecated since React 16.3.0, use UNSAFE_componentWillUpdate instead, see https://reactjs.org/docs/react-component.html#unsafe_componentwillupdate

      lib/Timepicker/Timepicker.js
      

      To not use the UNSAFE method, we need to use getDerivedStateFromProps or componentDidUpdate. The former occurs before render, but is a static method, meaning it cannot access `this` (instance props). The latter occurs after render() and cannot update the state (which would cause flickering); it is often used to apply focus() to an element.

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                stephaniesbuck Stephanie Buck
                rjruizes Roman Ruiz-Esparza
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases