S
SolidJS5w ago
Luka

FileRoutes layout

Can anyone help me set up layouts in solidstart?
No description
11 Replies
Luka
Luka5w ago
When user navigates to notifications I want them to see a sidebar meaning Account component and as a props.children I want to have Notifications component
REEEEE
REEEEE5w ago
lowercase 'A'
astroxvimy
astroxvimy5w ago
what is the current status?
Luka
Luka5w ago
Its the same Is there any component that I should import from solid like <Outlet> that react-router-dom has?
REEEEE
REEEEE5w ago
There used to be Outlet but it was removed in favor of props.children
Luka
Luka5w ago
OK could You look at the file structure I might have problems there
REEEEE
REEEEE5w ago
your layout files with () should be lowercase I think they have to match the same name as the folder
Luka
Luka5w ago
I can't make it work do you have an example? or documentation about it
REEEEE
REEEEE5w ago
(account)/
(notifications)/
index.tsx
(notifications).tsx
(account).tsx
(account)/
(notifications)/
index.tsx
(notifications).tsx
(account).tsx
I think something like this
Luka
Luka5w ago
I just wrapped the notification component code into the Account component and it works but I don't really know if this is recommended, as long as it works lol. Thanks @REEEEE
peerreynders
peerreynders5w ago
In case it wasn't clear from the previous example
src/routes/account.tsx # layout for /account
src/routes/account/index.tsx # default nested child content for /account
src/routes/account.tsx # layout for /account
src/routes/account/index.tsx # default nested child content for /account
If you need to be more specifc
src/routes/account.tsx # layout for /account
src/routes/account/(notifications).tsx # default nested child content for /account
src/routes/account.tsx # layout for /account
src/routes/account/(notifications).tsx # default nested child content for /account
Renaming Index Nested Layout Some people expect the layout to be collocated with the nested content similar to what Next.js chose to do with their layout.ts & page.ts. SolidStart on the other hand chose to mirror the route component structure, e.g.
<Router>
<Route path="/account" component={Account}>
<Route path="/" component={Notifications} />
</Route>
</Router>
<Router>
<Route path="/account" component={Account}>
<Route path="/" component={Notifications} />
</Route>
</Router>
Nesting Routes
Want results from more Discord servers?
Add your server
More Posts
Routing and using special characters with <FileRoutes>When using <FileRoutes> I that both: - `routes/[login, register].tsx` multiple routes to one handleCannot read properties of undefined @ router normalizePathHi! My issue is the one described up here in the title. The function that throws it is @solidjs > The combination of API routes and data loading functionsI have been trying out integrating my existing API routes with `cache` and `action` deploying to **cHow to Execute Server Action on Each Route Visit?I have a home component (code in comments) In summary, what this component does is it calls a serveThe requested module '/_build/node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/browser.js?v=d23I published a new version of `solid-markdown` a while ago, and it broke a lot of people's imports wiWhole page component rerenders in default Solid-Start projectWhen I'm trying to use input field, the whole page rerender after loading data from resource, causinSolidStart: Uncaught SyntaxError: The requested module '/_build/node_modules/resolve/index.js'I tried modifying and improving the official note app * adding formatting with prettier, added prettDifferent folder but making Vercel work on it (I'm a beginner)Hello. For school do I need to make a project in a default folder structure. How can I make Vercel wPath syntax flexibilityIs this example from the docs supposed to work? Seems nice to be able to select keys using a functiRenaming Index not working?Hi! I just created a project with SolidStart starter and chose the tailwind with typescript template