FirebaseExtended / reactfire

Hooks, Context Providers, and Components that make it easy to interact with Firebase.
https://firebaseopensource.com/projects/firebaseextended/reactfire/
MIT License
3.54k stars 401 forks source link

how to trigger parent re-render when using `remove` in realtime database? #573

Closed nonzer0 closed 1 year ago

nonzer0 commented 1 year ago

It's not clear to me in the scenario in which a child component in a react context performs a deletion of an item from the realtime database how it is that the parent component will trigger a re-render.

If the react context updates that would do it but since remove happens directly in firebase the context is unaffected.

jbaldassari commented 1 year ago

@nonzer0 I think the idea is that you would usually be subscribing to a collection/query and rendering each element from that with a .map() or similar. So if you remove an item from that collection, the collection (and therefore the subscription/query output) would be updated, which should trigger a re-render without the element that was deleted.

nonzer0 commented 1 year ago

oh I see what you mean thx @jbaldassari!