-
How can I synchronize the state of multiple autocomplete instance? the purpose of the multiple to handle desktop and mobile view |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Is there a reason you don't use a single instance for both with detached mode? You can use |
Beta Was this translation helpful? Give feedback.
-
Yeah I should init it twice to handle the big difference between desktop and mobile search ui's . Thanks for the answer I'll check it first, I'll let you know once it works |
Beta Was this translation helpful? Give feedback.
Is there a reason you don't use a single instance for both with detached mode?
You can use
const instance2 = autocomplete({onStateChange(state => instance1.setXXX(state.xxx))})
(depending on what you want to set, setters are documented here: https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/state/#setters)