react-pouchdb icon indicating copy to clipboard operation
react-pouchdb copied to clipboard

How to disable live change

Open pejman1 opened this issue 3 years ago • 1 comments

Is there any option or way to disable live change in useFind ?

pejman1 avatar Mar 29 '21 09:03 pejman1

No, but I think it would be useful option. Currently you have to use db.find and useEffect. Something like:

function MyComponent() {
  const db = useDB();
  const [result, setResult] = useState();

  useEffect(() => {
    async function find() {
      setResult(await db.find(/* ... */));
    }
  
    find();
  }, [db]);

  if (!result) {
    return null;
  }
  // ...
}

ArnoSaine avatar Mar 29 '21 11:03 ArnoSaine