theatre/packages/r3f/src/components/useRefreshSnapshot.ts
2021-09-06 10:19:10 +02:00

11 lines
306 B
TypeScript

import {useCallback} from 'react'
import {useEditorStore} from '../store'
/**
* Returns a function that can be called to refresh the snapshot in the snapshot editor.
*/
export default function useRefreshSnapshot() {
return useCallback(() => {
useEditorStore.getState().createSnapshot()
}, [])
}