How does FireCMS handle state? #141
-
Does this repo use a state management library like Redux, MobX or useSWR? Looking at the repo it doesn't look like it - just vanilla Firebase. Was curious as to how the library manages real-time updates. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @TheAussieStew :) We don't use any additional library for state management like the ones you mention. State should be held in the smallest scope possible, and that is how we mostly handle it in FireCMS. Regarding real time updates, we have created one interface called Datasource, that includes methods like Let me know if you have further questions! |
Beta Was this translation helpful? Give feedback.
Hi @TheAussieStew :)
We don't use any additional library for state management like the ones you mention.
I have used Redux before and I am not a huge fan. There is nothing wrong with it, but I have seen it misused too often. The most common mistake is mistake local state for global state. For example, having the content of a collection as global state, when it is local state to a table component only.
State should be held in the smallest scope possible, and that is how we mostly handle it in FireCMS.
In any case, we do have global state related to different parts of the app, such as the authentication state, or the order of the side panels, the snackbar controller... We implement those by…