Last active
January 30, 2019 02:24
-
-
Save sdymj84/deaba576d061ee5f8326595d01dc6f19 to your computer and use it in GitHub Desktop.
Components get data from redux store using dummy data
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
const mapStateToProps = (state) => { | |
return { | |
test: state.country | |
} | |
} | |
export default connect(mapStateToProps)(Home) |
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
import { createStore } from "redux"; | |
import { Provider } from "react-redux"; | |
import rootReducer from './reducers/rootReducer'; | |
const store = createStore(rootReducer) | |
ReactDOM.render( | |
<Provider store={store}> | |
<App /> | |
</Provider>, | |
document.getElementById('root') | |
); |
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
// dummy data | |
const initialState = { | |
test: { | |
country: "Minjun's world" | |
}, | |
} | |
const postReducer = (state = initialState, action) => { | |
return state | |
} | |
export default postReducer |
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
import firstReducer from './firstReducer' | |
import secondReducer from './secondReducer' | |
import { combineReducers } from 'redux' | |
const rootReducer = combineReducers({ | |
first: firstReducer, | |
second: secondReducer, | |
}) | |
export default rootReducer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment