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 { useSelector, useDispatch } from 'react-redux' | |
function connect(mapStateToProps, mapDispatchToProps) { | |
return Component => { | |
const Wrapper = props => { | |
const seletedState = useSelector(state => mapStateToProps(state, props)); | |
const dispatch = useDispatch(); | |
const boundDispatch = mapDispatchToProps(dispatch, props); | |
return <Component {...seletedState} {...boundDispatch} {...props} />; | |
}; |
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 { View, Text, Button } from 'react-native'; | |
import styles from './styles' | |
import { ContextProvider, Context } from './context'; | |
const Compo = () => { | |
const { type } = useContext(Context); | |
return ( | |
<View style={styles.container}> | |
<Text>{type}</Text> |