Uncaught Typeerror: Cannot Read Property 'parentnode' of Null

What'southward the problem TypeError: Cannot read property 'parentNode' of nil?

Here's the screen code:
5ddc28f877dbf391256791.png
Clicking on whatsoever of the two links in the console gives this error - TypeError: Cannot read property 'parentNode' of null
simply in the browser everything works fine and the links goes.
Utilize React-router-dom

1 respond

April 2nd 20 at 16:sixteen

Solution

Evidence lawmaking router

5ddc40ae621d0290789723.png - alfonzo_Abbott commented on Apr 2nd 20 at 16:19

@Imani, total code religion does not allow to throw? What kind of Router are yous using?
import { Router } from 'react-router-dom';
or

                  import { BrowserRouter as Router } from 'react-router-dom';                

? - barrett_Hil commented on Apr 2nd 20 at 16:22

In Full general, if the first option - supervene upon the 2d, it should work. If the second selection - that throw off the lawmaking in the sandbox, expect in fact - barrett_Hil commented on April 2nd 20 at 16:25

@Sammy26,

                  import { useHistory, BrowserRouter as Router, Switch Route Link } from 'react-router-dom';  function App() {   return ( <Router> <main>  <Header screenHandler={()=>{}} />  <Switch>  <Road exact path='/'>  <BlogScreen posts={Posts} /> </Route>  <Route path='/mail'>  <PostScreen /> </Route>  <Route path='/edit'>  <EditScreen onAddPostClick={createNewPost} onSavePostClick={changePost} /> </Route> </Switch> </main> </Router> ); }  export default App;                

- alfonzo_Abbott commented on April 2nd 20 at 16:28

@Imani, code MainButton place - barrett_Hil commented on April 2nd 20 at 16:31

@Sammy26,

                  import React from 'react'; import styled from 'styled-components';  const StyledButton = styled.push`  padding: 10px 20px;  font-size: 15px;  edge: none;  background-color: #fff;  color: #000; `;  const MainButton = ({children onButtonClick}) => (  <StyledButton onClick={onButtonClick}>{children}</StyledButton> );  consign default MainButton;                

- alfonzo_Abbott commented on Apr 2d 20 at 16:34

@Imani, the trouble must be in the button, remove information technology from the code and all should be apprx. Meet the method that triggered the onClick, something is wrong. Well, judging past the lawmaking y'all exercise non transfer any method, just call it when you click - barrett_Hil commented on April 2nd xx at 16:37

@Sammy26, no, button, I tried to remove, did not help, even when I changed the url using history.push() the page is inverse simply this error yet pop out. - alfonzo_Abbott commented on April 2nd twenty at xvi:40

A method that I pass, onButtonClick - alfonzo_Abbott commented on April 2nd 20 at xvi:43

@Imani, at that place yous the method to become, just you're not. Your button is rendered in the component Header, just no method in it, you're not. That is, your method in a button component === undefined. Effort instead of simply paste () => {console.log('click')}

If the problem persists - throw off the link to the repository - barrett_Hil commented on April second 20 at 16:46

@Imani, I have no errors either with the button or without - barrett_Hil commented on Apr 2nd 20 at 16:52

@Sammy26, then this is exactly the conflict that can throw off package.json? - alfonzo_Abbott commented on April 2nd 20 at 16:55

@Imani, I have it from your repository, respectively, the aforementioned - barrett_Hil commented on Apr 2nd twenty at 16:58

@Sammy26, and then what could be the problem, any idea? - alfonzo_Abbott commented on Apr 2d 20 at 17:01

@Imani, download your repository from github, maybe this will eliminate the mistake. But in General, the fault reports that something is trying to read property parentNode of undefined at/null node
Peradventure even in some place of the lawmaking you are trying to piece of work with the property DOM node, simply information technology is not - barrett_Hil commented on Apr 2nd xx at 17:04

@Sammy26, I nevertheless think it's a version conflict, just at outset I generated project using the create-react-app then I installed react-router-dom, and you're all set at a time... and I think that y'all create-react-app accept installed some package to some other version which is compatible with react-router-dom, do not know if the create-react-app automatically checks for alien dependencies and selects the version when initializing. In any case, cheers to you, this question will be useful to someone.
I, in plow, removed the react-router-dom and fabricated routing through the global country, the application is not big. - alfonzo_Abbott commented on Apr 2nd 20 at 17:07

Find more questions by tags JavaScriptReact

clayfectined.blogspot.com

Source: https://helperbyte.com/questions/463444/whats-the-problem-typeerror-cannot-read-property-parentnode-of-null

0 Response to "Uncaught Typeerror: Cannot Read Property 'parentnode' of Null"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel