I have pdf-viewer component
export default function PDFViewer({keyword}) {
const searchPluginInstance = searchPlugin({
keyword,
})
const {Search} = searchPluginInstance;
return (
<div>
<Search/>
<Viewer plugins={[searchPluginInstance]} />
</div>
)
}
keyword
is an array of strings that are passed down to the component. That passed keyword list is highlighted in the pdf doc that is the function. But this works only for the first render cycle. After I update the keyword in the parent component and pass it here, nothing is happening.
Basically, once it creates the searchPluginInstance
instance, It won’t change based on the props changes. I don’t know how to address thing issue? Is there a design pattern or something to handle this issue?