what is the desired way to connect slices/ the store to a database, i dont see a good pattern for it #3979
-
it seems to me that pulling data and using that data as the initial state would be a desired effect but i dont see any way to do that is a desirable way, everything feels hacky and weird, maybe there is already a pattern that i am not finding? i see some stuff that utilizes reducers and actions from the store/slice to dispatch events in the components when they load up that will send the request, but why cant i have the store make async calls when it is initialized? or on other store events? id like to pull data on app load that will then be used elsewhere in the app (pull data on store load, different components utilize data from the store instead of making calls themselves, reducers/actions for adding or removing from and updating the data), seems to me that it would be nice to be able to make these async calls on load and then have the ability later on to update that data, but again i cant find a good pattern to do the initial state on load with the store/ individual slices, idk im a little new to redux so like i said maybe these things are already solved for. like im just trying to load articles onto a page utilizing a mongodb and redux and im confusing myself and id be able to do this in a few minutes without redux, it makes no sense to me |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
i guess to clarify on the title and my specific problem, i do see how utilizing reducers and action can give you a desirable solution for most if not all crud operations, i guess i really just want a good way of initializing with existing data that is in the database already, but would also like to bring to the attention of people much more fluent in redux than myself that it is not immediately intuitive to me how to connect/utilize redux with a database |
Beta Was this translation helpful? Give feedback.
-
and i know data storage and state management are seperate, but the argument could be made that you should manage the state of the data coming from the db before its used in the view |
Beta Was this translation helpful? Give feedback.
-
Please see: |
Beta Was this translation helpful? Give feedback.
Please see: