r3f: Accept function for objRef like for setState

This commit is contained in:
Cole Lawrence 2022-07-18 21:00:42 -04:00
parent 415e493834
commit 58f04685ad

View file

@ -76,7 +76,10 @@ const createEditable = <Keys extends keyof JSX.IntrinsicElements>(
allRegisteredObjects.add(sheetObject)
setSheetObject(sheetObject)
if (objRef) objRef!.current = sheetObject
if (objRef)
typeof objRef === 'function'
? objRef(sheetObject)
: (objRef.current = sheetObject)
editorStore.getState().addEditable(storeKey, {
type: actualType,