I am working as React Developer for past 3 years now. I love to work with ReactJS/React Native. For some months I am using SvelteJS for my small and personal projects and it’s new fresh air in the JS environment and am really enjoying it.
I have already written some articles related to SvelteJS.
I find lifecycle in ReactJS and SvelteJS very much similar and very easy to understand. If you want to understand the lifecycle of React(class based lifecycle), check this.
I will be comparing the useEffect hook of React to lifecycle of Svelte.
Mounting is the initial and first lifecycle of any component where component is created and inserted in DOM.
If there is any state change, we can listen that update or get inform about that change.
After component is leaved or unmounted, we need to perform some tasks.