Is it possible to pass a ref as a value in the provider? #2040
captDaylight
started this conversation in
General
Replies: 1 comment
-
I ended up getting this to work like this. Maybe this is crazy? export default function MyProvider(props: MyProps) {
let ref: Ref<any> | undefined;
const [store, setStore] = createStore({
ref
});
createEffect(() => {
setStore({ ref });
});
return (
<MyContext.Provider value={store}>
<div ref={ref}>{props.children}</div>
</MyContext.Provider>
);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When I do this I'm not able to access the ref when I try to access it.
Is there a way to do this?
Beta Was this translation helpful? Give feedback.
All reactions