hello why i have typescript error?
CodePudding user response:
LibraryContext.Provider
is expecting libraryType.
While react query does its work the default value is undefined
.
So you may need to do something like this:
const defaultLibraryValue = {
name: '',
address: '',
phone: ''
//Add a default to each property of libraryType
} as libraryType;
<LibraryContext.Provider value ={{library: data === undefined ? defaultLibraryValue : data}}