Skip to content

Instantly share code, notes, and snippets.

@PatrickJS
Last active May 15, 2024 22:02
Show Gist options
  • Save PatrickJS/939151e1236ea66158200cff5ce52840 to your computer and use it in GitHub Desktop.
Save PatrickJS/939151e1236ea66158200cff5ce52840 to your computer and use it in GitHub Desktop.
const machine = useConst(() => {
return {
state: 'off',
_machine: undefined,
send: $((newState) => {
return this._machine ||= noSerialize(createMachine(this))).send(newState)
)
};
})
const useRef = () => useConst({current: undefined})
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