Last active
April 21, 2021 20:19
-
-
Save pckilgore/33214617d52904a04edb2c8078a50bac to your computer and use it in GitHub Desktop.
GlobalVariableContext.useSetValue();
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 React from "react"; | |
import { Button } from "react-native"; | |
import * as GlobalVariableContext from "./config/GlobalVariableContext"; | |
export const MyVariableSetter = () => { | |
const setGlobalVariable = GlobalVariableContext.useSetValue(); | |
const myNewValue = { key: "mySettableGlobal", value: "new value" }; | |
return ( | |
<Button onPress={() => setGlobalVariable(myNewValue)}> | |
"Update a Variable" | |
</Button> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment