mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-12 15:12:28 -05:00
ea2af56f7b
[web] Revert detach hooks from TS to JS GitOrigin-RevId: c108fe219d472f0c0b745dc8648fd15375f0e083
19 lines
404 B
JavaScript
19 lines
404 B
JavaScript
import { useEffect } from 'react'
|
|
import useDetachState from './use-detach-state'
|
|
|
|
function useDetachStateWatcher(key, stateValue, senderRole, targetRole) {
|
|
const [value, setValue] = useDetachState(
|
|
key,
|
|
stateValue,
|
|
senderRole,
|
|
targetRole
|
|
)
|
|
|
|
useEffect(() => {
|
|
setValue(stateValue)
|
|
}, [setValue, stateValue])
|
|
|
|
return [value, setValue]
|
|
}
|
|
|
|
export default useDetachStateWatcher
|