#React Context infer the type at context creation

2 messages · Page 1 of 1 (latest)

modern adder
#

how to infer the type that the context will provide instead of providing them in
React.createContext<thetypehere>(null)

river kindle
#

You can't, unless what you are passing in as the parameter is of the type you want.