Skip to content

Commit

Permalink
Update Index File Naming Convention (#768)
Browse files Browse the repository at this point in the history
  • Loading branch information
OussemaNehdi authored Jun 5, 2024
1 parent d6e4b65 commit a8dfef0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/routes/solid-start/building-your-application/routing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ export default function Index() {
By default, the component that is rendered for a route comes from the default export of the `index.tsx` file in each folder.
However, this can make it difficult to find the correct `index.tsx` file when searching, since there will be multiple files with that name.

To avoid this, you can rename the `index.tsx` file to the name of the folder it is in and it will be rendered as the default export for that route:
To avoid this, you can rename the `index.tsx` file to the name of the folder it is in, enclosed in parenthesis.

This way, it will be treated as the default export for that route:

```jsx {2, 4, 6}
|-- routes/ // example.com
Expand All @@ -88,7 +90,7 @@ To avoid this, you can rename the `index.tsx` file to the name of the folder it
|-- job-1.tsx // example.com/work/job-1
|-- job-2.tsx
|-- socials/
|-- socials.tsx // example.com/socials
|-- (socials).tsx // example.com/socials
```

#### Escaping nested routes
Expand Down

0 comments on commit a8dfef0

Please sign in to comment.