Skip to main content

Questions tagged [react-dom-server]

The react-dom/server package allows you to render your components on the server.

react-dom-server
0 votes
0 answers
45 views

Why my useState object returns null, although I defined it and set a value to it?

This is the access to my server: const {id}=useParams(); const [card,setCard]=useState({}); console.log(id); // useEffect(()=>{ // console.log('Component rendering...'); ...
tavor doron's user avatar
3 votes
1 answer
869 views

Getting `ReferenceError: TextEncoder is not defined` after upgrading Jest

I'm currently in the process of ejecting a rather large create-react-app project. While I was at it, I also updated Jest's version from ~27 to ~29. There was a breaking change in v28 that required me ...
Lukas Müller's user avatar
0 votes
0 answers
293 views

How to fix the 'Warning: useLayoutEffect does nothing on the server', when using reactDOMServer.renderToString()?

Using React 17, and MaterialUIv5, with the following code: const htmlString = reactDOMServer.renderToString(MyReactComponent) I get the following error in the console: Warning: useLayoutEffect does ...
steve238's user avatar
  • 1,121
0 votes
1 answer
155 views

How to get dom events like onClick and onChange to work when serving a tsx file with Bun.serve() and no framework

I'm trying to use Bun and it's optimized built-in React library, without a framework, to build a simple one-page form application. I found work-arounds for dealing with icons and css, but ran into ...
Colin Keenan's user avatar
  • 1,139
0 votes
0 answers
536 views

NextJS Cannot read properties of undefined (reading 'slug')

I received this Server Error from a Post.js file from a blog site i'm building and can't figure out how to fix it. After a lengthy search/investigation i'm unable to find anything to help correct it ...
anterrysocial's user avatar
2 votes
0 answers
148 views

React-Dom issue after upgrading to next 12

I have upgraded my large project form Next 10 to Next 12, and I am getting this error: app_container | Error: Element type is invalid: expected a string (for built-in components) or a class/function (...
Atonic's user avatar
  • 529
0 votes
1 answer
308 views

Is it possible to use react hooks in a component that will be rendered with renderToString

I have a component that contains react-router-dom's Link but throws the error below when I pass the component in the react-dom renderToString Uncaught Error: useHref() may be used only in the context ...
Lekan Lawal's user avatar
2 votes
0 answers
286 views

warrning: React.jsx: type is invalid -, caught Error: Element type is invalid: expected a string

my code seems fine but nothing come out, my App.js import logo from './logo.svg'; import './App.css'; import React from 'react'; function App() { return ( <div ...
Chai Yon Xing's user avatar
0 votes
1 answer
589 views

Build error using Astro framework & react-image-gallery

I am using "astro": "~2.3.0" with "@astrojs/react": "~2.1.1" (using "react": "~18.2.0", "react-dom": "~18.2.0") & &...
menepet's user avatar
  • 864
0 votes
1 answer
1k views

Cannot read properties of undefined (reading '_internalRoot')

I am trying to switch the rendering method according to the env flag. since i am much new for react needs the help to understand the correct way. getting an error as, TypeError: Cannot read ...
hasina rajik's user avatar
3 votes
2 answers
3k views

Next Build Error - Error occurred prerendering page / TypeError: Cannot read properties of null (reading 'useMemo')

I'm trying to update a 2 year old project, and I've been having so much trouble after updating the dependencies Right now after running 'next build', I keeps seeing: Error occurred prerendering page &...
Not Michael's user avatar
0 votes
1 answer
481 views

ReactDOMServer not found, but it is on package.json

I'm getting this result on my npm start log: Can't resolve 'react-dom/server' in 'C:\Users\Alvaro\git\Fancy\lab\src\components\data-visualization\chart' If you're trying to use a package make sure ...
Alvaro Silva's user avatar
-1 votes
1 answer
1k views

Is there a way to accomplish `renderToStaticMarkup` on the client-side in React 18

We are currently using ReactDOM.renderToStaticMarkup to render a tooltip within highcharts. const chartOptions: Options = { chart: { height }, tooltip: { ..., formatter: function (...
scott dickerson's user avatar
0 votes
1 answer
254 views

I am trying to create a navbar that link to different route with React/typescript but when i create a link i keep getting an error

import React from 'react' import { Link } from 'react-router-dom' export default function NavBar() { return ( <div className='NavContainer'> <link to='/home'>Home</link&...
Nasiru Ismail's user avatar
0 votes
2 answers
826 views

How to server-side render a specific route in ReactJS?

I would like to server-side render only a specific route in React. For example, /home should be client-side rendered, but /post should be server-side rendered. The /post route receives a post ID as a ...
Daniel Jung's user avatar

15 30 50 per page
1
2 3 4 5 6