Ref module namespace for creating mutable references.
Create a Ref to hold a mutable reference to a value.
// For DOM elementsconst inputRef = yield* Ref.make<HTMLInputElement>()// Later, focus the inputyield* inputRef.value.pipe( Effect.tap((el) => Effect.sync(() => el.focus())))// For any valueconst cleanupRef = yield* Ref.make<() => void>()cleanupRef.current = () => console.log("cleanup") Copy
// For DOM elementsconst inputRef = yield* Ref.make<HTMLInputElement>()// Later, focus the inputyield* inputRef.value.pipe( Effect.tap((el) => Effect.sync(() => el.focus())))// For any valueconst cleanupRef = yield* Ref.make<() => void>()cleanupRef.current = () => console.log("cleanup")
Ref module namespace for creating mutable references.