quangnd / login-form-multilang-with-context

Using React Contexts for theme and multilanguage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Login form with React Contexts for theme and multi-language 👔

See in action at Login form

Netlify Status

What is Context?

  • Context provides a way to pass data through the component tree without having to pass props down manually at every level.
  • Context lets you “broadcast” such data, and changes to it, to all components below. Common examples where using context might be simpler than the alternatives include managing the current locale, theme, or a data cache.

When to use Context?

  • Context is designed to share data that can be considered "global" for a tree of React components, such as the current authenticated user, theme, or preferred language.
  • Context is primarily used when some data needs to be accessible by many components at different nesting levels. Apply it sparingly because it makes component reuse more difficult. If you only want to avoid passing some props through many levels, component composition is often a simpler solution than context.

References

About

Using React Contexts for theme and multilanguage


Languages

Language:JavaScript 85.5%Language:HTML 9.4%Language:CSS 5.1%