Skip to content

Repository files navigation

Context API Example

Context API example using TypeScript and custom Provider/Consumer

The AppContextProvider

Check src/contexts/AppContext.tsx for the definition and App.tsx for usage.

The consumers

There are two examples of consumers in this project:

Tip

This is a didactic example, but ideally, you should not export AppContext in src/contexts/AppContext.tsx, but only the providr AppContextProvider and the consumer useAppContext. This way, external users will not have unnecessary imports to choose.

Extra

[outdated but can be useful] PT-BR Lesson: https://youtu.be/niTUo4u1xlY

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages