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
Play this game by pasting the script in http://www.puzzlescript.net/editor.html |
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 { useEffect, useRef, useState } from 'react'; | |
// This hook receives three parameters: | |
// storageKey: This is the name of our storage that gets used when we retrieve/save our persistent data. | |
// ttl (seconds): How long it should be kept in browser storage | |
// initialState: This is our default value, but only if the store doesn't exist, otherwise it gets overwritten by the store. | |
// Example: | |
// Store a state that can be any or null and keep it cached for 15 minutes. | |
// [state, setState] = usePersistentState<any | null>("project.key", 15 * 60, null); |
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
Play this game by pasting the script in http://www.puzzlescript.net/editor.html |
OlderNewer