Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENHANCEMENT] Adding a centralized state (Redux/MobX/Recoil) #92

Open
SujayDas1999 opened this issue Dec 27, 2023 · 22 comments
Open

[ENHANCEMENT] Adding a centralized state (Redux/MobX/Recoil) #92

SujayDas1999 opened this issue Dec 27, 2023 · 22 comments
Assignees
Labels
enhancement Enhancement to the existing code

Comments

@SujayDas1999
Copy link

Description

I have been going through the react code and I have an enhancement suggestion. Instead of using use state, can we migrate the application to use a centralized state such as Redux/MobX/Recoil ?

Current Behavior

The jsx files uses use state hook. There is no centralized state.

Proposed Enhancement

To implement Redux like centralized state management system.

Use Case

To implement Redux like centralized state management system by which a state can be used my multiple components without using props or drilling down props (if props are required).

Blockers

No response

Additional Information/ Attachments

No response

@SujayDas1999 SujayDas1999 added the enhancement Enhancement to the existing code label Dec 27, 2023
@krishnaacharyaa
Copy link
Owner

Yes @SujayDas1999, Thank you for opening this issue, we can aim for RTK query, and we can aim for the latest and minimalistic state management, because using redux will be an overhead for application of this small scale,
Interested to know your thoughts if you are open to working on this.

@SujayDas1999
Copy link
Author

SujayDas1999 commented Jan 15, 2024

I would suggest to use Zustand/Recoil since the code effort will be way less than using RTK query. It is simple & and minimalistic.

Zustand :- https://zustand-demo.pmnd.rs/
Recoil :- https://recoiljs.org/

Please let me know your thoughts on this.

[Edit] Apologies for the confusion. But I believe that RTK Query is used for querying the API. In this enhancement I am talking about plain state management like having a centralized state which will be accessible to all components irrespective of their relation for which we have to use Redux Took-Kit (since you are looking for a minimalistic approach). Should we be using both RTK Query + Redux Toolkit combined ? Or just RTK Query ?

@krishnaacharyaa
Copy link
Owner

Okay sounds interesting,
Can we discuss about this in the discord...
Once we agree to an approach we'll go with that

@SujayDas1999
Copy link
Author

Hi @krishnaacharyaa please let me know when we can connect on discord

@krishnaacharyaa
Copy link
Owner

Hi @SujayDas1999 , I have messaged in the discord kindly look into..

@theEdgeBreaker
Copy link

Hi @krishnaacharyaa, I would like to add Redux Toolkit.

@krishnaacharyaa
Copy link
Owner

Hi @theEdgeBreaker Actually after multiple iterations we wanted to go with zustand, can you please let us know what is the adv and dis of redux toolkit and zustand from there we can pick this

@theEdgeBreaker
Copy link

Hi @krishnaacharyaa, Reason for Redux is that it has larger and robust community and we can get more people contributing later if needed in Redux as compared to Zustand. If someone is working in this project for learning then they'll be more demanding in Industry as Redux is used in Large scale projects which hires people. Ultimately some day this project might also grow. I can pick any of them but in case of Redux Toolkit, I can finish the setup in few days time.

@krishnaacharyaa
Copy link
Owner

@theEdgeBreaker Thank you for the detailed opinion and thinking about the future contributors...
Yeah all the points you said are really vaild, but here, why we were thinking of zustand is ... The project in the future scope even won't scale to the extent that we have to use redux and it creates too much boilerplate for a simple blog application and might make people anxious by seeing it as it's aimed for new people to dive in and learn MERN and to understand the not soo complex project....

So for the present scenario and even for the foreseeable future we wouldn't want to use redux as the project won't go that crazy complex... So we can go with the trending zustand, which is robust as redux but reduces the very much boilerplate of redux and can handle even if the project scales ...

So we came to this discussion of using zustand....
This would be a rather decent change aimed to simplify the things than complicating it ....

You might ask,Why do we need state management afterall? It a simple app working just fine without it, it is simple the way it is...
Answer is because of the bug #98
Which can be handled by state management...
Aggreed we can also solve it using localstorage.... But thought it would be nice to have decent state management to handle this ...

@krishnaacharyaa
Copy link
Owner

Hi @theEdgeBreaker May I know if you wanna take this up? I'll assign it to you....

@theEdgeBreaker
Copy link

theEdgeBreaker commented Mar 26, 2024

Hello @krishnaacharyaa, Yes you can assign me this, I want to work on it.

@krishnaacharyaa
Copy link
Owner

Sure @theEdgeBreaker, let us work on the MVP and as mentioned let's try to resolve the bug which I mentioned in the previous comment....first and then let's see if there is any further scope....

@krishnaacharyaa
Copy link
Owner

Hi @theEdgeBreaker , may i know the update on this, and how much further time it would roughly take ?

@theEdgeBreaker
Copy link

Hi @krishnaacharyaa, I used Zustand but the bug wasn't resolved, so I'm trying another approach. I'll give you updates today

@krishnaacharyaa
Copy link
Owner

@theEdgeBreaker raise PR, let's see... I guess we can solve that without state management, one guy is working on it,

@krishnaacharyaa
Copy link
Owner

Hi @theEdgeBreaker, the issue is solved here #116 (review), Pardon me, I haven't actually went through that, Now I am just wondering what will be the scope of using State management as Zustand now karke... Do you have any take on this?

@theEdgeBreaker
Copy link

Hi @krishnaacharyaa, I don't think Zustand played any role in this, so I'll look into another one to address.

@krishnaacharyaa
Copy link
Owner

Yeah exactly @theEdgeBreaker .

"so I'll look into another one to address."

Didn't get you

@krishnaacharyaa
Copy link
Owner

I'm just wondering now, why we need zustand as simple as the question gets !

@theEdgeBreaker
Copy link

@krishnaacharyaa, I'll take another issue to solve,
Probably issue #70.

@krishnaacharyaa
Copy link
Owner

@theEdgeBreaker Sure, Just let us know the appraoch before implementing

@krishnaacharyaa
Copy link
Owner

@theEdgeBreaker Were you able to find some issue worth contributing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to the existing code
Projects
None yet
Development

No branches or pull requests

3 participants