docs: mention kebab case naming for islands (#572)
This commit is contained in:
@@ -8,8 +8,8 @@ components that are rendered on the client. This is different from all other
|
|||||||
components in Fresh, as they are usually just rendered on the server.
|
components in Fresh, as they are usually just rendered on the server.
|
||||||
|
|
||||||
Islands are defined by creating a file in the `islands/` folder in a Fresh
|
Islands are defined by creating a file in the `islands/` folder in a Fresh
|
||||||
project. The name of this file must be a PascalCase name of the island. The file
|
project. The name of this file must be a PascalCase or kebab-case name of the
|
||||||
must have a default export that is a regular Preact component.
|
island. The file must have a default export that is a regular Preact component.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
// islands/MyIsland.tsx
|
// islands/MyIsland.tsx
|
||||||
|
|||||||
@@ -21,9 +21,10 @@ Fresh embraces this model. All pages are rendered server side, but you can
|
|||||||
create "island components" that are _also_ rendered client side. To do this,
|
create "island components" that are _also_ rendered client side. To do this,
|
||||||
Fresh projects have a special `islands/` folder. The modules in this folder each
|
Fresh projects have a special `islands/` folder. The modules in this folder each
|
||||||
encapsulate a single island component. The name of the module should be the
|
encapsulate a single island component. The name of the module should be the
|
||||||
[pascal case][pascal-case] name of the island component. For example a counter
|
[pascal case][pascal-case] or [kebab case][kebab-case] name of the island
|
||||||
component would be defined in the file `islands/Counter.tsx`. A buy now button
|
component. For example a counter component would be defined in the file
|
||||||
would be defined in the file `islands/BuyNowButton.tsx`.
|
`islands/Counter.tsx`. A buy now button could be defined in the file
|
||||||
|
`islands/buy-now-button.tsx`.
|
||||||
|
|
||||||
Here is an example of an island component that counts down to a specific time.
|
Here is an example of an island component that counts down to a specific time.
|
||||||
|
|
||||||
@@ -94,3 +95,4 @@ The page that is rendered on the client now has an interactive countdown.
|
|||||||
|
|
||||||
[islands-architecture]: https://jasonformat.com/islands-architecture
|
[islands-architecture]: https://jasonformat.com/islands-architecture
|
||||||
[pascal-case]: https://en.wiktionary.org/wiki/Pascal_case
|
[pascal-case]: https://en.wiktionary.org/wiki/Pascal_case
|
||||||
|
[kebab-case]: https://en.wiktionary.org/wiki/kebab_case
|
||||||
|
|||||||
Reference in New Issue
Block a user