fixed save generated content in useEditorData

This commit is contained in:
Jan Prochazka
2021-01-30 10:37:28 +01:00
parent d3039a9248
commit dcfefc78a2
2 changed files with 4 additions and 0 deletions

View File

@@ -15,6 +15,8 @@ export default function useStorage(key, storageObject, initialValue) {
return initialValue;
}
});
// use storedValue to ref, so that setValue with function argument works without changeing setValue itself
const storedValueRef = React.useRef(storedValue);
storedValueRef.current = storedValue;