Skip to content

Removed createClass as its deprecated #699

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,6 @@ Now, you can create React components in `.jsx` files:
```js
// app/assets/javascripts/components/post.jsx

window.Post = React.createClass({
render: function() {
return <h1>{this.props.title}</h1>
}
})

// or, equivalent:
class Post extends React.Component {
render() {
return <h1>{this.props.title}</h1>
Expand Down Expand Up @@ -395,7 +388,7 @@ rails g react:component Post title:string published:bool published_by:instanceOf
would generate:

```js
var Post = React.createClass({
class Post extends React.Component{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we change the documentation for ComponentGenerator, should we also update the code to match the new documentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its a great idea

propTypes: {
title: React.PropTypes.string,
published: React.PropTypes.bool,
Expand All @@ -411,7 +404,7 @@ var Post = React.createClass({
</div>
);
}
});
};
```

The generator also accepts options:
Expand Down