Skip to content

componentWillMount and friends deprecated from React #373

Closed
@catmando

Description

@catmando

componentWillMount (before_mount callback), componentWillUpdate (before_update callback), componentWillReceiveProps (before_new_params callback) have been deprecated.

Here is the plan to replace the first two:

before_mount

The before_mount callback can be implemented as part of the render_wrapper method, so the callbacks get called just before calling the application render method.

before_update

The before_update callback can be implemented the same as before_mount, however, React did pass the "old-state" and "new-state" values to the callback. This notion is meaningless in Hyperstack, but there possibly could be code around that is using the lower level "props" and is depending on the old-state and new-state.

So for now we will use the react UNSAFE_componentWillUpdate callback (which gives no warning, but implements the legacy behavior, then in the callback we will check if the proc is receiving any parameters, and if so publish a deprecation notice that in the future these parameters will NOT be passed.

Then at some future release, the code will use the same mechanism as before_mount (i.e. it's just part of the render wrapper)

before_new_params

This is sort of being replaced by a static (read class level) call back called getDerivedStateFromProps but the whole thing is probably unnecessary in hyperstack since the hyper-state component manages state changes to avoid rerenders (which is the base reason for this being replaced.)

So we will just deprecate this method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatibilitycompatibility with dependencies such as Rails, Opal, React, etc. NOT FUNCTIONAL COMPATIBILITY

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions