Closed nkovacic closed 5 years ago
MappedActions and MappedState types already exists but a combined type is missing. We now have to merge them by hand. Would be great if this could be added to the main library.
type MappedActionsAndState = MappedActions<typeof MainConnect> & MappedState<typeof MainConnect>; class Main extends PureComponent<MappedActionsAndState> { render() { return ( <View> <CustomText> Current route: {this.props.currentRoute} </CustomText> </View> ); } } const MainConnect = createAppConnect({ mapState: state => ({ currentRoute: state.routingSelector.currentRouteSelector() }), mapActions: actions => ({ changeRoute(route: string) { actions.routingActions.changeRoute(route); } }) }); export default () => ( <MainConnect> {(data, actions) => <Main {...data} {...actions} />} </MainConnect> );
Why not. Added MappedStateAndActions in the v0.8.1 release.
MappedStateAndActions
MappedActions and MappedState types already exists but a combined type is missing. We now have to merge them by hand. Would be great if this could be added to the main library.