I'm very new in this technology stack but i'm confused about something:
I have a react container that handle what view should be shown to the user in the app:
const mapStateToProps = (state) => {
return {
currentScreen: state.currentScreen
}
}
and also handle when the app should change the current screen:
const mapDispatchToProps = (dispatch) => {
return {
changeScreen: (newScreen) => {
dispatch(changeScreen(newScreen))
}
}
}
but is "connected" connect() only with App component:
import App from '../components/App'
const AppScreen = connect(
mapStateToProps,
mapDispatchToProps
)(App)
How can I share with all components the changeScreen function?