The react-dom/server package allows you to render your components on the server.
Questions tagged [react-dom-server]
74 questions
10
votes
1 answer
React SSR instead of 'getInitialProps' of 'next.js'
For improving TTFB (time to the first byte), the 'PageSpeed Insights
' suggests using ReactDOMServer.renderToNodeStream(), but I don't know how to implement it.
I read the rendertonodestream article, but I don't know how to use it.
Also, I read the…

S. Hesam
- 5,266
- 3
- 37
- 59
9
votes
3 answers
Will ReactDOM.hydrate() trigger lifecycle methods on the client?
From the React 16 docs about ReactDOM.hydrate(),
Same as render(), but is used to hydrate a container whose HTML contents were rendered by ReactDOMServer. React will attempt to attach event listeners to the existing markup.
Will…

Naisheel Verdhan
- 4,905
- 22
- 34
7
votes
1 answer
Uncaught TypeError: Cannot read property 'hasOwnProperty' of undefined react-dom.production.min.js:760
I'm getting this error when I try to open my build project
by the way the project works fine in development mode.
Uncaught TypeError: Cannot read property 'hasOwnProperty' of undefined
at Object. (react-dom.production.min.js:760)
…

Anas M K
- 107
- 1
- 1
- 7
6
votes
0 answers
Is data-reactroot relevant to the hydrate function in React?
I was trying to understand what's the difference between ReactDOMServer.renderToString() and ReactDOMServer.renderToStaticMarkup() on React 16.8.6.
This is what I understood:
renderToStaticMarkup() is used on the server side when you just want to…

Wagner Meyer
- 61
- 3
6
votes
1 answer
Server-side rendering with React with a randomly generated string?
I'm trying server-side rendering for the first time in my React/Redux app. An issue I'm having right now is that I need the initial state to have a randomly generated string and then pass it as a prop to my main App component. This is obviously…

Saad
- 49,729
- 21
- 73
- 112
5
votes
1 answer
React JS TypeError: Cannot read property 'length' of undefined at areHookInputsEqual
I am facing some errors while rendering at SSR for some URL using renderToString from "react-dom/server"
I am getting following error:
TypeError: Cannot read property 'length' of undefined
at areHookInputsEqual…

Bhavik Agrawal
- 61
- 1
- 3
5
votes
3 answers
Injecting gatsby-image into html created from markdown using ReactDOMServer.renderToString
Minimum Reproducible Example on Github
I'm trying to inject some images into my pages created from markdown. I'm trying to do this using ReactDomServer.renderToString()
const componentCreatedFromMarkdown = ({data}) => {
...
useEffect(() =>…

Sam
- 1,765
- 11
- 82
- 176
5
votes
0 answers
Rendering Component as Leaflet Marker using renderToString loses theme
We have a react project that uses styled components, with a ThemeProvider providing a theme object that all of the components should be able to reference. In this project, we have a leaflet map, and we're adding React components to it in the form of…

Steve Dockery
- 51
- 1
5
votes
0 answers
React-Router redirect through server
So I'm working on a site that wants links with the following path:
localhost:3000/visit/:name
To redirect to an external url for example google.com?affiliateID=2. The redirect needs to be nofollow with status code 307.
The app is universal;…

user15628
- 65
- 5
4
votes
1 answer
setting "type" to "module" in package.json then not able to read es modules
CONTEXT:
I'm trying to start with SSR using react, and I've ran into this problem before the updates, and I'm pretty sure I'm missing something obvious but I'm not sure what it could be.
In my root directory I've got public, server, and…

djossir
- 73
- 1
- 6
4
votes
1 answer
TypeError: element.type.toLowerCase is not a function
I am facing an issue while setting up SSR for a react app.The Server side code for the render is as below:
app.use((req, res) => {
const context = {}
const body = ReactDOMServer.renderToString(
React.createElement(
…

user3062513
- 410
- 1
- 10
- 19
3
votes
0 answers
react - renderToNodeStream, getting [Object] appear in browser
I am using renderToNodeStream in an SSR react application.
const markup = (

JoeTidee
- 24,754
- 25
- 104
- 149
3
votes
0 answers
ReactDOMServer not render to react-twitter-embed
I'm trying to render embed tweets with ReactDOMServer.renderToString but it doesn't work.
I'm using react-twitter-embed npm package.
I also tried with another jsx functions it works. But tweet embed doesn't work. My code and demo in…

mehmetdemiray
- 976
- 4
- 13
- 32
3
votes
0 answers
How to access a React element that has been rendered with renderToString and added with dangerouslySetInnerHTML?
EDITED: I corrected how I do inject the code, it is not MDX related, it is simply plain html
I have html code that I insert to my React page with
dangerouslySetInnerHTML={{ __html: myContent }}
Before, I've added some components to myContent with…

GWorking
- 4,011
- 10
- 49
- 90
3
votes
2 answers
React isomorphic component with both client-side and server-side rendering
I want to create a react app with both client side and server side rendering.
Here is the example:
import styles from './Main.css';
import React, {Component} from 'react';
import Info from './Info/Info';
import Record from './Record/Record'
export…

chenatu
- 827
- 2
- 10
- 22