Comments (2)
To clarify how Expo Router works - all routes are accessible from any page if you link to it. Likewise, all routes are deep-linkable. If you have a link to a route, it will work, no matter where you are.
Groups have 1 purpose, to select what _layout
(and consequently what navigator) is rendered.
If you want a /users/[id]
route that keeps within the same navigator that you are currently in , then your files structure should be
(home)/
├─ _layout.tsx
├─ index.tsx
├─ users/
│ ├─ index.tsx
(profile)/
├─ _layout.tsx
├─ profile.tsx
├─ users/
│ ├─ index.tsx
Where both users/index.tsx
files reexport the same UsersPage component. This is similar to React Navigation where you would need to have two <Screen />
components that have the same component.
Shared groups are for when you have routes that have their own layouts, but could belong to multiple groups. We can't do what we did before (create multiple users/index.tsx
files) because they are still under their parents _layout
. The shared groups syntax allows you to express this.
The other purpose are pages with unique layouts
(home)/
├─ _layout.tsx
├─ index.tsx
├─ users/
│ ├─ index.tsx
(profile)/
├─ _layout.tsx
├─ profile.tsx
├─ users/
│ ├─ index.tsx
(profile,home)/
├─ _layout.tsx
├─ settings.tsx
Say we have have navigated from /
to /settings
. The Settings page has a Href to /users/1
, but which route do we navigate to? Shared groups retains the state of which group you were in so it will navigate you to the correct /users/1
from expo.
Thank you a lot for taking the time and writing this detailed answer. It makes much more sense now for me.
Thanks again, and have a nice day!
from expo.
Related Issues (20)
- [docs] Invalid discord invite HOT 1
- BroadcastReceiver not trigerring app if it is not in foreground or background. HOT 2
- "Cannot read property 'blobId' of undefined" - Production when using polyfill
- 'Prebuild' command creates 'ios' script in package.json even if --platform is set to 'android' HOT 4
- Image-Manipulator images are not showing up in the devices photos when saved HOT 1
- Uncaught Error: Cannot access 'Object' before initialization HOT 8
- Image-Manipulator doesn't save images in a devices gallery HOT 4
- ReachabilitySwift.bundle missing "NSPrivacyCollectedDataType", "NSPrivacyCollectedDataTypePurposes" for "NSPrivacyCollectedDataTypes" HOT 5
- Expo-image-picker on android requires permission WRITE_EXTERNAL_STORE but does not request it HOT 1
- Expo-image-picker - Launching camera does not work on Android 10-12 HOT 1
- expo-image stopAnimating() with AVIF does not work on iOS HOT 29
- AppContext.<init> java.io.EOFException - Detect premature EOF HOT 2
- [expo-notifications] data-only notification notification shown in notifications tray HOT 7
- The useSegments hook is causing an extra re-render when navigating to index pages from nested navigators
- QRCode rendered by expo start cannot be read
- "@typescript-eslint/ban-types" deprecated but "eslint-config-expo" use it when put to extends
- FetchError Invalid response body with npx expo install --check HOT 1
- [docs] Migration to eslint-config-expo
- [expo-contacts] Persistent GetContactsAsync crash on ios HOT 1
- MD5 erroneous difference due to permissions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from expo.