ts(2503) 1

ts(2503)

Your file extension is most likely `.ts` instead of `.tsx`.

Therefore TypeScript is interpreting 
as cast and tries to find a type Provider in the namespace ctx.

Here is what the above code is Doing:
1. We’re creating a context object using React.createContext().
2. We’re creating a provider React component that provides the
surrounding state to any consuming components that are descendants
of this provider.
3. We’re creating a consumer React component that retrieves the
surrounding state.
4. We’re wrapping our provider around the rest of our app so any
component can access the state.
5. We’re using the useState() hook to create state variables and
setter functions.
6. We’re using the useEffect() hook to load the data from the API
and save it to state.
7. We’re using the useContext() hook to retrieve the state and
setter functions so we can display the data.

Similar Posts