[QUESTION] Components vs Islands
- Should I create a separate
/componentsfolder for my.tsxcomponents if they are not strictly interactive like islands supposed to be? Or do I need to put such components inside/islanddirectory no matter if they are interactive or not? - Is it a requirement for an island to be interactive?
- What is considered interactive in terms of islands?
- In what way are islands (I assume that islands are considered to be all the
.tsxfiles in/islandsdirectory) treated differently from just regular.tsxcomponents? If I do this...
/** @jsx h */
import { h } from "preact";
import MyComponent from "../some-random-directory/MyComponent.tsx";
export default function Home() {
return (
<MyComponent/>
);
}
...how exactly it is being treated differently from this...
/** @jsx h */
import { h } from "preact";
import MyComponent from "../islands/MyComponent.tsx";
export default function Home() {
return (
<MyComponent/>
);
}
I did read about island architecture and somewhat understood it, so my questions are more about best practices (or at least how people think it should be done) of creating an app with Fresh.
It seems that what I'm asking is similar to what is discussed in https://github.com/denoland/fresh/discussions/326#discussioncomment-3058069 and proposed in https://github.com/denoland/fresh/issues/350
I suppose I should have posted this question in the discussion tab. I'm sorry.
Components are static, islands are dynamic. They should be split across folders as such. You should never have static islands.
Interactive means you need to do some logic client side, for example onclick, useEffect, useState or similar.