`Uncaught TypeError: Cannot read property 'textContent' of null` with SSR in next.js
See original GitHub issueHere is my react page:
import { motion } from "framer-motion";
import styled from "styled-components";
const Outer = styled(motion.div)`
height: 100vh;
display: flex;
place-items: center;
background-color: #232323;
`;
const Inner = styled(motion.div)`
height: 100px;
width: 100px;
background-color: cadetblue;
border-radius: 5px;
`;
const Framer = () => (
<Outer>
<Inner>
Hey
</Inner>
</Outer>
);
export default Framer;
This is located under the /pages
folder in a next.js app.
With <Inner>Hey</Inner>
, it all works fine, but change this to <Inner />
and it consistently gives me Uncaught TypeError: Cannot read property 'textContent' of null
when rendering on the server.
This has been a consistent problem whilst I’m getting to grips with next.js. It’s hampering my production.
Error is reproduced on next.js@9.2.0 and next.js@9.1.7
<Outer>
<h1>Hey</h1>
<Inner />
</Outer>
Tested with above and renders fine. It would seem next.js pages need a little bit of text!
Initially asked on StackOverflow.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Cannot read property 'textContent' of null` with SSR in next.js ...
This is located under the /pages folder in a next.js app. With <Inner>Hey</Inner> , it all works fine, but change this to <Inner...
Read more >`Uncaught TypeError: Cannot read property 'textContent' of ...
With <Inner>Hey</Inner> , it all works fine, but change this to <Inner /> and it consistently gives me Uncaught TypeError: Cannot read property...
Read more >uncaught typeerror cannot set properties of null ... - You.com
Error "Uncaught TypeError: Cannot read properties of null (reading 'textContent')" on cmspageform.bundle.js?1.7.8.2:26 appears on console when edit a page. I ...
Read more >View Raw - UNPKG
... (2017-12-04) ## Bug fixes * Fix bug about text filter for null ... Bug fixes * Fixed ExpandComponent.js:47 Uncaught TypeError: Cannot read...
Read more >Updates - React PDF Viewer
Can't render certain PDF documents that contain an annotation whose ... The `Bookmarks` component provides new property that can be used to set...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Removing the google chrome extension JSON Viewer Awesome seems to have fixed this.
Parses as JSON without text, but renders markup with text.
For anyone arriving here from google as I did when searching for my issue:
was my issue as well. This is not a nextjs issue by any means, just a over-eager chrome extension (relevant issue)