Skip to content

React 18 Incompatibility: BlobUploader needs to be updated with current lifecycle #32

@alexandervalencia

Description

@alexandervalencia

Currently Unsplash React is receiving the following console warning:

console.js:213 Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.

* Move data fetching code or side effects to componentDidUpdate.
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.

Please update the following components: BlobUploader2

src/uploaders/blob_uploader.js is currently using the componentWillReceiveProps lifecycle method which will not work in React 18. This component should be updated to either use the UNSAFE_ method or be made into a function component.

Either way, this will require moving the dependency for React from >=15 to >=16.8 As the UNSAFE_componentWillReceiveProps wasn't introduced until React 16.8. (Although UNSAFE_componentWillReceiveProps appears to have issues with Suspense and React.lazy in React 18+)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions