Jeremy
PD🧩 Plasmo Developers
•Created by AP on 2/10/2024 in #👾extension
Help with showing script ui. (content.tsx) when clicking on chrome extension
@AP Figured it out you need to use the Storage hook:
In background.ts
import { Storage } from "@plasmohq/storage"
chrome.action.onClicked.addListener(async (tab) => {
console.log(" I waass clicked")
await storage.set("isOpen", true)
}) const storage = new Storage()storage.watch({
"isOpen": (c) => {
console.log(c.newValue)
},
})
In Content.tsx
const [isOpenStorage, setIsOpenStorage] = useStorage("isOpen", false)
And render conditionally on the isOpenStorage4 replies
PD🧩 Plasmo Developers
•Created by AP on 2/10/2024 in #👾extension
Help with showing script ui. (content.tsx) when clicking on chrome extension
@AP Did you figure this out ? Currently also struggling to make this work :/
4 replies