Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove React.createClass and React.PropTypes from docs #9355

Closed

Conversation

flarnie
Copy link
Contributor

@flarnie flarnie commented Apr 6, 2017

These commits update the docs to remove React.createClass and React.PropTypes, replacing them with create-react-class and prop-types libraries. More details below;


I did not add sections for create-react-class and prop-types under add-ons in the navigation. It seemed duplicative of the info on React without ES6 and Typechecking with PropTypes guides, and long term we want to probably remove the add-ons docs section anyway.

It's unclear how contextTypes will work without React.PropTypes. Let's assume that, for now, we will get users to use the external PropTypes when defining context. I will update this PR if we
want a different approach.

The `React.createComponent` method is being deprecated in favor of
`createReactComponent`.
It no longer makes sense to have a section for the 'createClass' method
in this page, since it won't be available as a top level method on
'React'.

I initially was going to pull the section about 'createClass' into a
separate page to add under 'addons' but it was short and duplicative of
the 'react-without-es6' docs. So I just linked to those.
I am doing the docs for `context` in a separate commit because that case
was a bit less clear-cut.

We will no longer support `React.PropTypes` as a built-in feature of
React, and instead should direct folks to use the `PropTypes` project
that stands alone.

Rather than retaining the `React.PropTypes` examples and just revamping
them to show the use of the stand-alone `PropTypes` library with React,
it makes more sense to direct people to that project and reduce the
perceived API area and complexity of React core. The proper place to
document `PropTypes` is in the README or docs of that project, not in
React docs.
We use `React.PropTypes` to define the `contextType` for the `context`
feature of React. It's unclear how this will work once `React.PropTypes`
is replaced by the external `PropTypes` library. Some options;

a) Deprecate `context`, either in v16 or shortly after. Seems reasonable
based on the intense warnings against using context that we have in the
docs -
https://facebook.github.io/react/docs/context.html#why-not-to-use-context
**Except** that probably some widely used libraries depend on it, like
`React-Router`.

b) Expect users will use external `PropTypes` library when defining
`contextTypes` and just don't do our `checkReactTypeSpec` against them
any more in v16.

c) Stop masking context and pass the whole context
unmasked everywhere. Worst option, do not recommend.

I went with `b` and assume that, for now, we will get users to use the
external `PropTypes` when defining context. I will update this PR if we
want a different approach.
@flarnie flarnie added this to the 15-hipri milestone Apr 6, 2017
@flarnie flarnie mentioned this pull request Apr 7, 2017
2 tasks
@acdlite acdlite closed this Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants