Reputation: 1
Im trying to set uiState in another component in my Vue project. This is my template, which includes the ais-instant-search component and the function(onStateChange) that is fired when I change the filters in my refinementList:
<template>
<ais-instant-search :index-name="indexName" :search-client="algolia" :on-state-change="onStateChange">
<div class="home-page-container">
<HomePage />
</div>
</ais-instant-search>
</template>
const onStateChange = ({ uiState, setUiState }: IOnStateChange) => {
setUiState(uiState)
}
At this point I am able to control my uiState. But i need to set it in another component - HomePage for example. How can I acces the setUiState function and manually set the uiState in other component?
I tried to pass the function using provide, but it looks like it doesn't work.
Upvotes: 0
Views: 400
Reputation: 389
in React it is possible to use hooks in any component
const { setUiState } = useInstantSearch()
I don't know if there is something similar in Angular.
Upvotes: 0