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
function App() { | |
return ( | |
<> | |
<Switch> | |
<Route path="/static_droid"> | |
<h1>Static droid page</h1> | |
<StaticPreview canvasStyle={canvasStyle} debug /> | |
</Route> | |
<Route exact path="/:packagingName?"> | |
<CreationContainer canvasStyle={canvasStyle} showDebugPanel /> |
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
// Une valeur globale de contexte permet de passer à un composant enfant une valeur | |
// définie dans un composant plus haut, sans avoir à passer par toutes les props des | |
// composants intermédiaires | |
export const CreationDispatch = React.createContext<Dispatch<CreationAction>>( | |
null! | |
); | |
// Dans le composant parent, on instancie dispatch et on le passe dans | |
// dans la valeur de contexte | |
function parentComponent() { |