Using Redux framework with Firebase in Android

I recently used Redux recently, and I wanted to create a simple application with it. I already made the main structure with my own implementation of State, Reducer and Action.

But I am wondering how to add some data to the application using Firebase. By this, I mean what might be the best practice for structuring and externalizing data calls, similar to the State of Redux application. I’ve already thought about creating control and dispatch actions that call data, but Firebase uses a lot of callbacks, so I don’t find a good way to manage it by following this pattern.

Can someone give me a hand on the good practice of structuring the data model in an Android application after the Redux pattern?

Thank you so much in advance.

+5
source share
1 answer

I worked on this in one of my applications using Redux and Firebase. What I used is similar to what is described in this blog post about creating an application to respond, reduce, firebase using auth .

Basically, you create actions that start listening for changes in Firebase data, and then when they receive these changes, they send new data with the appropriate action (CREATE_ENTITY, UPDATE_ENTITY, DELETE_ENTITY, etc.) so that you can make the correct changes in your gearboxes.

These actions trigger when your application starts, as they are necessary to listen for all data changes in Firebase.

+2
source

Source: https://habr.com/ru/post/1258028/


All Articles