Skip to content

Seb's Deprecation Wishlist Umbrella #9475

@sebmarkbage

Description

@sebmarkbage

I have a list of breaking changes that I'd like to see because I think they're not strictly necessary features, can often be replaced by other APIs and their very existence makes implementations more constrained, even when they're not used.

This list is not meant to be anything we're planning on actively doing. It's just a drop point where I can add things as I think of them.

  • Shallow freeze the defaultProps object and make the defaultProps property non-configurable/non-writable after the first createElement or createFactory call. (Enables inlining/resolution of defaults statically.)

  • Treat key/ref as a separate namespace in JSX. Meaning that objects that are spread onto JSX don't transfer key and ref. Enables inlining of props object even if spread type is unknown. E.g.

let x = <Foo {...{key:'bar'}} />;
x.key; // null
x.props.key; // 'bar'
let y = <Foo key="bar" />;
y.key; // 'bar'
y.props.key; // undefined
  • Drop support for string refs.

  • Drop support for ReactDOM.findDOMNode(...) and ReactNative.findNodeHandle(...). These are slower in Fiber and requires a tree to be materialized/stateful/introspectable at arbitrary times/threads even before we know if this will ever get called. Less automatic cleanup. Could possibly have an alternative API that works more like refs. However, just ref forwarding probably solves all legit use cases better.

  • Make .type and .props private on ReactElements so that they can't be introspected (just like bound functions/closures). This makes optimizations like automatic making components asynchronous/synchronous safe or inlining components several levels deep.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions