-
-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useContext example from docs not working. #406
Comments
I've encountered the same issue but was able to fix it with the following:
In your child you just do the following:
|
It seems like the solution to the useContext issue is to update the docs to fix the types? I think this would be the change with the correct types: interface UserState {
profile: {
name: string;
};
}
const StateContext = createContext<Observable<UserState>>(undefined as any);
function App() {
const state$ = useObservable({
profile: {
name: "",
},
})
return (
<StateContext.Provider value={state$}>
<div>
<Sidebar />
<Main />
</div>
</StateContext.Provider>
)
} |
@Brentably If there's a problem with @EnterNameHere7 I think your context example would be very problematic. Putting an |
Was really excited to try this out, unfortunately, immediately get
This error, because no argument is put into createContext. I've tried setting it to null, tried setting it to an observable of the initial state. Nothing works. Here is my _app.tsx file:
Another one that I get a lot if I try to useObserver is:
The text was updated successfully, but these errors were encountered: