State Management Advice

Hi everyone, I have a lot of nesting components inside a single component in which I need to share the state that means I have to pass nested props that look kinda ugly to me and then the state is also shared among two components on the same page. Currently I'm using Pinia store but that makes it a global state that stays throughout the lifecycle of the whole app. I'm seeking any advice that anybody can give on this. Thanks for your time
2 Replies
Muhammad Mahmoud
You could set the state in the parent component and use provide & inject to pass the state to all child components only and not global state.
Yte50
Yte508mo ago
I recommend using pinia, any other method would become a hassle in the future, with pinia you can always create a new store and rewrite a new efficient code when the idea drops in
Want results from more Discord servers?
Add your server