View gist:6a21b4fb9e61471e00abedb3876a426c
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
$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User") | |
[System.Environment]::SetEnvironmentVariable("PATH", $userenv + ";C:\Users\Administrator\Ubuntu", "User") |
View reactComposeExample.jsx
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 Composer from 'react-composer'; | |
<Composer | |
components={[ | |
<CurrencyConsumer/>, | |
<LocaleConsumer />, | |
<ThemeConsumer/> | |
]}> | |
{([currency, locale, theme]) => ( | |
<MyComponent currency={currency} locale={locale} theme ={theme} /> |
View reactComposeExamle.jsx
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 Composer from 'react-composer'; | |
<Composer | |
components={[ | |
<CurrencyConsumer/>, | |
<LocaleConsumer />, | |
<ThemeConsumer/> | |
]}> | |
{([currency, locale, theme]) => ( | |
<MyComponent currency={currency} locale={locale} theme ={theme} /> |
View unstatedExample.jsx
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
// @flow | |
import React from 'react'; | |
import { render } from 'react-dom'; | |
import { Provider, Subscribe, Container } from 'unstated'; | |
type CounterState = { | |
count: number | |
}; | |
class CounterContainer extends Container<CounterState> { |
View basicContextUsage.jsx
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 { Provider, Consumer } = React.createContext("Scuba Manager"); | |
render() { | |
return ( | |
<Provider value="Scrum Master"> | |
<Consumer> | |
{ (userRole) => <span>Role: {userRole}</span> /* <span>Role: Scrum Master</span>*/} | |
</Consumer> | |
</Provider> | |
) |
View basicContextUsage.jsx
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 { Provider, Consumer } = React.createContext("Scuba Manager"); | |
render() { | |
return ( | |
<Provider> | |
<Consumer> | |
{ (userRole) => <span>Role: {userRole}</span> } | |
</Consumer> | |
</Provider> | |
) |
View context.jsx
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 {Provider, Consumer} = React.createContext(defaultValue); |
View test.jsx
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 {Provider, Consumer} = React.createContext(defaultValue); |