Skip to content

Is there a way to add Provider to root node with new routing system ? #46

Answered by bndkt
Dhananjay-JSR asked this question in Q&A
Discussion options

You must be logged in to vote

You would use a layout route for this, see https://expo.github.io/router/docs/features/layout-routes.

Your (layout).tsx could then look like this:

import { Children } from "expo-router";
import { Provider } from "../components/Provider";

export default function Layout() {
  return (
    <Provider>
      <Children />
    </Provider>
  );
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by EvanBacon
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #40 on October 03, 2022 19:57.