You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/2/en/part2a.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -413,16 +413,16 @@ import App from "./App"
413
413
414
414
Let's move our <i>Note</i> component into its own module.
415
415
416
-
In smaller applications, components are usually placed in a directory called <i>components</i> within the <i>src</i> directory. The convention is to name the file after the component.
416
+
In smaller applications, components are usually placed in a directory called <i>components</i> within the <i>src</i> directory. The convention is to name the file after the component. A possible directory structure for a project containing multiple components could be as follows:
417
417
418
418
```shell
419
419
src/
420
-
├── main.jsx# Entry point
421
-
├── App.jsx# Main App component
422
-
└── components/ # All reusable components
423
-
├── Note.jsx # Named after the component
424
-
├── Header.jsx
425
-
└── Footer.jsx
420
+
├── main.jsx
421
+
├── App.jsx
422
+
└── components/ # Folder for reusable components
423
+
├── Footer.jsx # File named after the component
424
+
├── Note.jsx
425
+
└── Notification.jsx
426
426
```
427
427
428
428
Now, we'll create a directory called <i>components</i> for our application and place a file named <i>Note.jsx</i> inside. The contents of the file are as follows:
Copy file name to clipboardExpand all lines: src/content/2/fi/osa2a.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -405,7 +405,17 @@ import App from "./App"
405
405
406
406
Siirretään nyt <i>Note</i>-komponentti omaan moduuliinsa.
407
407
408
-
Pienissä sovelluksissa komponentit sijoitetaan yleensä <i>src</i>-hakemiston alle sijoitettavaan hakemistoon <i>components</i>. Konventiona on nimetä tiedosto komponentin mukaan.
408
+
Pienissä sovelluksissa komponentit sijoitetaan yleensä <i>src</i>-hakemiston alle sijoitettavaan hakemistoon <i>components</i>. Konventiona on nimetä tiedosto komponentin mukaan. Useita komponentteja sisältävän projektin hakemistorakenne voisi olla siis esimerkiksi seuraava:
0 commit comments