You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
export function useData() {
const context = useContext(DataContext)
if (!context) {
throw new Error('Missing Data context')
}
return data
}
Maybe introduce major update to the whole react-basic lib, so that all components carry additional phantom type contexts :: ContextList and top React.render should take empty context?
The text was updated successfully, but these errors were encountered:
This is intentional. The createContext function in react-basic requires a default value and that value is used when the current React tree doesn't have a value to use from a parent provider.
createContext::foralla. a->Effect (ReactContexta)
If you can't provide a useful default value, you can always make your a a Maybe something.
If you're running into a runtime error here you're most likely using FFI somewhere, such as specifying in PS the context type of a JS React library. In this case it's really important JS's possible edge cases are caught or you've given the context type the actual JS type (often Nullable something, not Maybe something).
it's a usual thing to do in js
Maybe introduce major update to the whole react-basic lib, so that all components carry additional phantom type
contexts :: ContextList
and topReact.render
should take empty context?The text was updated successfully, but these errors were encountered: