How do I open a new tab and use the fetch function?

Development environment: react

now that you have done it, click and use the fetch method to get a link on the current page and jump to the target page.
how to keep the current page, open a new tab and use the fetch method to get a link, and then jump to the target page.
current code:

getService(API_PREFIX + "/services/user/loginLingShen", data2 => {
            console.log(data2);
            fetch(data2.result, {     //fetchget
              method: "GET",
              mode: "no-cors",
              credentials: "include",
              cache: "no-store",
              headers: {
                "Content-Type": "application/json",
              },
            }).then(function (response) {
              return response.text().then((json) => {
                window.location="http://www.linksame.com";     //get
              });
            }).catch((error) => {
              console.log(error);
            });
Dec.08,2021

looking at the description, it seems that the communication between the parent and child components can solve the problem.


let w = window.open ("about:blank")

Menu