How to re-render the component in react if useState does not change or hold the last value

  hook, javascript, reactjs
  • I have a useState
    const [selectFolderId, useSelectFolderId] = React.useState(

  • Im reading from redux store, but sometimes when im changing the URL and change the document Store, my selectFolderId, always hold the last value, and does not update with the new value from DocumentStore.
    I did a useEffect passing props such as the URL or the documentStore to update the state but I’m not getting results from this.

    useEffect(()=>{ setFolderId( }, [url, documentStore])

There is a way to always reset the value and re-render the component.
I guess react is always holding the same data from the cache, and does not update the UI, maybe does not know my has other value, then I don’t have the data in the folderId that I would need.
Thanks for any help

Source: Ask Javascript Questions