PD
🧩 Plasmo Developersrosemont
How to create a new tab from a router?
Given an index.tsx:
ex.
import { Route, Routes } from "react-router-dom"
import { Login } from "~newtab/login"
export const Routing = () => (
<Routes>
<Route path="/newtab/login" element={<Login />} />
</Routes>
)
that is mapped from the popup.tsx as follows:
import { Routing } from "~routes"
import React from "react";
function IndexPopup() {
return (
<Routing />
)
}
export default IndexPopup
How can i get my first login route to create a new tab?
rosemont•15d ago
update: I was able to use useLocation to solve this:
export const Routing = () => {
const location = useLocation();
useEffect(() => {
if (location.pathname === "/") {
openLoginTab();
}, [location]);
const openLoginTab = () => {
chrome.tabs.create({url: 'chrome-exension://{x}/newtab/login'});
};
where the routes are the same as above
hovever; now I am facing an issue where the new tab is blocked by brave browser. There is nothing but straight jsx on the login page (no api call or anything); how could i solve this?
2.1KMembers
View on DiscordWant results from more Discord servers?
More PostsCan a Browser Extension look like Apple's Dynamic Island?I've never built a browser extension, but I had an inkling of a UI idea to build something akin to hHow do you debug a problem when yarn dev just exits?I've got a bug where when I run yarn dev, it exists without printing anything useful:
(base) james@just out of curiosity, where does the storage live?why does it work? i cannot find any cookie or localstorage where the keys i setup from plasmo are, iSend data from content script or popup to main content script.I want to manipulate some dom items on the main world, how do I send a message from my popup or my oLoading a content script on a specific tabHowdy folks,
I'm wanting to explicitly load a content script on a specific tab, so it doesn't interfanyone using authjs with plasmoIf yes, how did you go about this?