This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react' | |
| export default class Counter extends Component { | |
| state = { | |
| count: 0 | |
| } | |
| increment = () => { | |
| this.setState({ | |
| count: this.state.count + 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import Counter from './Counter' | |
| const App = () => <Counter /> | |
| export default App |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import { render } from 'react-dom'; | |
| import App from './App'; | |
| import registerServiceWorker from './registerServiceWorker'; | |
| render(<App />, document.getElementById('root')); | |
| registerServiceWorker(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react' | |
| export default class Counter extends Component { | |
| increment = () => { | |
| // preencher depois | |
| } | |
| decrement = () => { | |
| // preencher depois | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { connect } from 'react-redux' | |
| import Counter from './Counter' | |
| function mapStateToProps(state) { | |
| return { count: state.count } | |
| } | |
| export default connect(mapStateToProps)(Counter) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import { Provider } from 'react-redux' | |
| import { createStore } from 'redux' | |
| import CounterContainer from './Counter.container' | |
| const store = createStore() | |
| const App = () => ( | |
| <Provider store={store}> | |
| <CounterContainer /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Provider } from 'react-redux'; | |
| ... | |
| const App = () => ( | |
| <Provider> | |
| <CounterContainer /> | |
| </Provider> | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import { Provider } from 'react-redux' | |
| import { createStore } from 'redux' | |
| import CounterContainer from './Counter.container' | |
| function reducer() {} | |
| const store = createStore(reducer) | |
| const App = () => ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import { Provider } from 'react-redux' | |
| import { createStore } from 'redux' | |
| import CounterContainer from './Counter.container' | |
| function reducer() { | |
| return { | |
| count: 42 | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import { Provider } from 'react-redux' | |
| import { createStore } from 'redux' | |
| import CounterContainer from './Counter.container' | |
| function reducer(state, action) { | |
| return { | |
| count: 42 | |
| } | |
| } |