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 Context calling React.Component constructor #612

Merged
merged 6 commits into from
Nov 20, 2016
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Contributors: please follow the recommendations outlined at [keepachangelog.com]

## [Unreleased]

## [6.2.1] - 2016-11-19
- Removed unnecesary passing of context in the HelloWorld Container example and basic generator. [#612](https://github.com/shakacode/react_on_rails/pull/612) by [justin808](https://github.com/justin808)

## [6.2.0] - 2016-11-19
##### Changed
- Updated the generator templates to reflect current best practices, especially for the redux version. [#584](https://github.com/shakacode/react_on_rails/pull/584) by [nostophilia](https://github.com/nostophilia).
Expand Down Expand Up @@ -378,7 +381,8 @@ Best done with Object destructing:
##### Fixed
- Fix several generator related issues.

[Unreleased]: https://github.com/shakacode/react_on_rails/compare/6.2.0...master
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/6.2.1...master
[6.2.1]: https://github.com/shakacode/react_on_rails/compare/6.2.0...6.2.1
[6.2.0]: https://github.com/shakacode/react_on_rails/compare/6.1.2...6.2.0
[6.1.2]: https://github.com/shakacode/react_on_rails/compare/6.1.1...6.1.2
[6.1.1]: https://github.com/shakacode/react_on_rails/compare/6.1.0...6.1.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export default class HelloWorldContainer extends React.Component {
name: PropTypes.string.isRequired, // this is passed from the Rails view
};

constructor(props, context) {
super(props, context);
constructor(props) {
super(props);

// How to set initial state in ES6 class syntax
// https://facebook.github.io/react/docs/reusable-components.html#es6-classes
Expand All @@ -19,9 +19,7 @@ export default class HelloWorldContainer extends React.Component {

render() {
return (
<div>
<HelloWorld name={this.state.name} updateName={this.updateName} />
</div>
<HelloWorld name={this.state.name} updateName={this.updateName} />
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import ReactOnRails from 'react-on-rails';

import HelloWorldContainer from '../containers/HelloWorldContainer';

const HelloWorldApp = (props) => (
// _railsContext is the Rails context, providing contextual information for rendering
const HelloWorldApp = (props, _railsContext) => (
<HelloWorldContainer {...props} />
);

Expand Down
2 changes: 1 addition & 1 deletion lib/react_on_rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true
module ReactOnRails
VERSION = "6.2.0".freeze
VERSION = "6.2.1.rc.3".freeze
end
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-on-rails",
"version": "6.2.0",
"version": "6.2.1-rc.3",
"description": "react-on-rails JavaScript for react_on_rails Ruby gem",
"main": "node_package/lib/ReactOnRails.js",
"directories": {
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ../..
specs:
react_on_rails (6.2.0)
react_on_rails (6.2.1.rc.3)
addressable
connection_pool
execjs (~> 2.5)
Expand Down
4 changes: 2 additions & 2 deletions spec/dummy/client/app/components/HelloWorld.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class HelloWorld extends React.Component {
};

// Not necessary if we only call super, but we'll need to initialize state, etc.
constructor(props, context) {
super(props, context);
constructor(props) {
super(props);
this.state = props.helloWorldData;
this.setNameDomRef = this.setNameDomRef.bind(this);
this.handleChange = this.handleChange.bind(this);
Expand Down
4 changes: 2 additions & 2 deletions spec/dummy/client/app/components/HelloWorldRedux.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export default class HelloWorldRedux extends React.Component {
};

// Not necessary if we only call super, but we'll need to initialize state, etc.
constructor(props, context) {
super(props, context);
constructor(props) {
super(props);
this.setNameDomRef = this.setNameDomRef.bind(this);
this.handleChange = this.handleChange.bind(this);
}
Expand Down