What is the purpose of default value in context?

  • To provide a fallback value when a context value is not available
  • To override the context value in child components
  • To provide a default value for the context provider
  • To prevent child components from accessing the context value
The default value in context is used to provide a fallback value when a context value is not available. When a component consumes a context value, it looks for the context value in its ancestors. If no ancestor provides a value, the default value is used instead. The default value is typically used as a fallback or to provide a default value for the context.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *