Skip to content

Proposal: Remove React.DOM (dom component factories) API and release as new module #6169

Closed
@zpao

Description

@zpao

The React.DOM API (not to be confused with ReactDOM) does not make sense in the greater scheme of the React API being used in other rendering environments like React Native or GL or <insert anything that isn't the DOM>. The React.* API is meant to be universal in that sense. We are never going to add React.iOS.

However, these factories don't actually have any implementation details that rely on actual DOM details, they essentially just map like so: React.DOM.div = (...args) => React.createElement('div', ...args), which is why they ended up in the universal React package and not in ReactDOM.

This would only impact people who don't currently use JSX and have held out using the function call syntax. <div/> now (and has for over a year) transforms to React.createElement('div'). The conveniences of the function syntax are a big deal for many people (especially coffeescript users and those who are strongly anti-JSX) so we don't want to break anybody, but we would like to migrate them from the core React API.

So the proposal would be a new package which just exports the exact set of things that React.DOM currently makes available. It would require some small changes to your code and a new package dependency, but is otherwise identical. Here's what the change might look like.

// before
{div, span} = React.DOM

// after
{div, span} = require('react-some-other-package');

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions