D
D
Denioo2020-05-13 14:57:05
JavaScript
Denioo, 2020-05-13 14:57:05

Routing error?

Hello, there was a problem when I write routing. It is necessary that /linka page opens on which there are reading scripts and then another page is launched in a new window. I run through And everything works, everything opens, but at the same time an error occurs on the page
window.open('https://newlink.ru ')
/link

Error: Objects are not valid as a React child (found: [object Window]). If you meant to render a collection of children, use an array instead.
 in div (at link.js:7)
    in link (created by Context.Consumer)
    in Route (at FireLink.js:59)
    in Router (created by BrowserRouter)
    in BrowserRouter (at FireLink.js:58)

In the file FireLink, the routes are written like this:
<BrowserRouter>
  <Route path='/link'  exact component={link} />
</BrowserRouter>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denioo, 2020-05-13
@Denioo

As one of the solutions I see the usewindow.location.href

D
Dmitry, 2020-05-13
@dimoff66

Translation: instead of a valid jsx, you returned a regular object somewhere. The line where you did it is div (at link.js:7) Put a breakpoint at this place and see what you get back there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question