简体   繁体   中英

Updating mobx store after database insertion

Is there a way to send an event with js to trigger a ui update (refresh?) off database insertion?

I'm building a web app to handle a queuing system for my school. I've gotten the major systems in place and working. Tutors are reading off a active q array in a nosql databse (couchDB). When students q, a new object is created there. The problem is, the Tutor has to manually refresh the page to see any new objects that have been added after they've loaded the page.

I know Redux would solve this problem, but the rest of my team is not keen to switch. Mobx is my state manager, and the app is built in react. So is there a way to trigger a specific Tutor refresh off a insertion into the db?

Turns out there is a built in API method in pouchDB for just this. https://pouchdb.com/api.html#changes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM