How to keep the content.tsx open (or open again) when navigating to a new page?
I am trying to redirect the user from the content to a new page (for web scraping uses) and I need to open the extension again once the new page is opened.
3 Replies
If you need persistent, use the CS for scraping, and a separate tab page for notification.
if it's a SPA page, you can listen to one of their anchor and remount as needed - I added a global watch method that will let you rerender your entire dom tree as welll
I found a solution using the storage API @plasmohq/storage
One question I have now, is how to use this way with default data
const [data, setData] = useStorage({
key: "data",
instance: localStorage
})
I need it to be local, but I can't set the default value like I would useStorage("data", [])
the 2nd argument is how you set default value:
Note that the above form works in most case but not entirely when it comes to hydrating in multiple place. You might want to use the function form instead;