Skip to content
Open
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
10 changes: 7 additions & 3 deletions reselect-example/src/app/components/HearthstoneCardList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import HearthstoneCard from './components/HearthstoneCard';
import './styles.css';

class HearthStoneCardList extends Component {
componentWillMount() {
this.props.dispatch(hearthstoneActions.getHearthstoneCards());
componentDidMount() {
this.props.getHearthstoneCards();
}

render() {
Expand All @@ -35,4 +35,8 @@ const mapStateToProps = store => ({
loading: store.hearthstone.cardsLoading
});

export default connect(mapStateToProps)(HearthStoneCardList);
const mapDispatchToProps = dispatch => ({
getHearthstoneCards: () => dispatch(hearthstoneActions.getHearthstoneCards())
});

export default connect(mapStateToProps, mapDispatchToProps)(HearthStoneCardList);
10 changes: 7 additions & 3 deletions reselect-example/src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import hearthstoneActions from '../redux/hearthstone/actions';
import HearthstoneCardList from './components/HearthstoneCardList';

class App extends Component {
componentWillMount() {
componentDidMount() {
setInterval(
() => this.props.dispatch(hearthstoneActions.otherAction()),
() => this.props.otherAction(),
500
)
}
Expand All @@ -28,4 +28,8 @@ const mapStateToProps = store => ({
tickCount: store.hearthstone.count
});

export default connect(mapStateToProps)(App);
const mapDispatchToProps = dispatch => ({
otherAction: () => dispatch(hearthstoneActions.otherAction())
});

export default connect(mapStateToProps, mapDispatchToProps)(App);
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { Component } from 'react';
class IncrementalCounter extends Component {
state = { value: 0 };

componentWillMount() {
componentDidMount() {
setInterval(
() => this.setState(prevState => ({ value: prevState.value + 1 })),
1000
Expand Down
2 changes: 1 addition & 1 deletion using-purecomponent/src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class App extends Component {
otherProps: { password: '1234' }
};

componentWillMount() {
componentDidMount() {
setInterval(
() => {
this.setState(prevState => ({ counter: prevState.counter + 1 }));
Expand Down