Skip to content

Components should extend Component class #18

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

Merged
merged 1 commit into from
Aug 3, 2015
Merged
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
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function select(state) {
};
}

class CounterContainer {
class CounterContainer extends Component {
render() {
// connect() call below will inject `dispatch` and
// every key returned by `select` as props into our container:
Expand Down Expand Up @@ -145,7 +145,7 @@ function select(state) {
};
}

class CounterContainer {
class CounterContainer extends Component {
render() {
const { dispatch, counter } = this.props;

Expand All @@ -172,9 +172,10 @@ Finally, how do we actually hook it up to a Redux store? We need to create the s
The trick is to wrap the whole view hierarchy into `<Provider>{() => ... }</Provider>` where `Provider` is imported from `react-redux`. One gotcha is that **the child of `Provider` must be a function**. This is to work around an issue with how context (undocumented feature we have to rely on to pass Redux data to components below) works in React 0.13. In React 0.14, you will be able to put your view hierarchy in `<Provider>` without wrapping it into a function.

```js
import { Component } from 'react';
import { Provider } from 'react-redux';

class App {
class App extends Component {
render() {
// ...
}
Expand Down