Hi, we are using Proxy for the appSearch and wondering, how to change the endPoint and searchKey once the user is authenticated. I'm using useEffect and dynamically changing the endPoint and searchKey if the user is authenticated. But the appSearch keeps taking only the endpoint and searchKey with the initialized ones.
Everything will need to be completely re-initialized.
A practical way to do this in React is to force your component tree to remount from as high in your component tree as possible.
For instance, if all of the code you posted is contained in an "App" component, you could use a "key" prop to force it to re-mount every time that "accessToken" changes.
i still see it is using the old values even though i could see the key got updated in the components section. anyway to clear the cache it might be using?
Thanks Jason. I've created the wrapper and still didn't work. I found out that the order of updating was incorrect and hence it is not being reflected. i've changed the order in the useEffect and now it is working correctly as expected. Thanks a lot for your help.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.