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
// context | |
const UserContext = React.createContext({}) // {} is default value | |
// imagine this being a deeper child | |
const Page = props => <ContextProvider.Consumer> | |
{(user) => <p>{user.name}</p>} | |
</ContextProvider.Consumer> | |
class App extends Component { |
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 item = { | |
type: 'something', | |
age: 23, | |
person: { | |
name: 'Michael' | |
} | |
} | |
const createItem = params => ({...item, ...params}) |