Created
October 30, 2017 21:10
-
-
Save Chalarangelo/efddfae3d79289ae0845cd096fea1829 to your computer and use it in GitHub Desktop.
This file contains 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
// React and other imports... | |
import { connect } from 'react-redux'; | |
import { viewAll, searchPost } from './actions'; | |
class App extends Component { | |
// Code for our App component... | |
} | |
// Mapping state to props | |
function mapStateToProps(state){ | |
return { | |
posts: state | |
} | |
} | |
// Connecting the App component | |
export default connect(mapStateToProps, { viewAll, searchPost })(App); |
This file contains 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
// React and other imports... | |
import App from './App'; | |
import { Provider } from 'react-redux'; | |
import { createStore } from 'redux'; | |
import reducer from './reducers'; | |
import registerServiceWorker from './registerServiceWorker'; | |
// Creating a store | |
const store = createStore(reducer); | |
// Wrapping our app inside a provider | |
ReactDOM.render( | |
<Provider store={store}> | |
<App /> | |
</Provider>, | |
document.getElementById('root')); | |
registerServiceWorker(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment