sveltejs / svelte

web development for the rest of us
https://svelte.dev
MIT License
79.98k stars 4.25k forks source link

Docs: The concept of "component initialisation" is mentioned several times in the docs without ever being explained. #10687

Open samal-rasmussen opened 8 months ago

samal-rasmussen commented 8 months ago

Describe the problem

The concept of "component initialisation" is mentioned several times in the docs, but it is never explained what it is.

Mentioned several times on this page: https://github.com/sveltejs/svelte/blob/main/documentation/docs/03-runtime/01-svelte.md

And one time here: https://svelte.dev/docs/svelte-components#script-4-prefix-stores-with-$-to-access-their-values

I've been thinking over this and haven't come up with a clean one sentence explanation or else I would have jumped right to a PR. Opening this bug report because this concept deserves a little introduction in the docs before being used repeatedly.

Li Hau Tan has a long explanation of youtube: https://www.youtube.com/watch?v=PI54YD4GsCc

Describe the proposed solution

Add a short concise explanation of what component initialisation is to the docs.

Importance

would make my life easier

samal-rasmussen commented 8 months ago

Also is this concept completely obsolete in Svelte 5? Can I just close this issue as obsolete? :)

dummdidumm commented 8 months ago

It's not obsolete 😃 Probably makes sense to have some kind of component life cycle section, where this can be termed.

samal-rasmussen commented 8 months ago

I just realized that Li Hau Tan's book starts with explaining the Svelte lifecycle phases in great detail. There are four lifecycle phases according to Li: Initialising, Mounting, Updating, and Destroying. At the very least the docs need need to say this.