Last active
May 15, 2024 22:02
-
-
Save PatrickJS/939151e1236ea66158200cff5ce52840 to your computer and use it in GitHub Desktop.
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 machine = useConst(() => { | |
return { | |
state: 'off', | |
_machine: undefined, | |
send: $((newState) => { | |
return this._machine ||= noSerialize(createMachine(this))).send(newState) | |
) | |
}; | |
}) |
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 useRef = () => useConst({current: undefined}) |
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
export const useSignal: UseSignal = (initialState?: any) => { | |
return useConst(() => createSignal(initialState)); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment