The react-dom/server package allows you to render your components on the server.
Questions tagged [react-dom-server]
74 questions
1
vote
1 answer
Image is not loading in server side rendering with react
I'm doing server-side rendering with React DOM Server using Create React App. I'm trying to load a static image but it's not showing up in my browser. Here is my app.js code
import './App.css';
import React from "react";
import Pic from…

Abdullah Qureshi
- 161
- 8
1
vote
0 answers
Using renderToNodeStream with react-rails / webpacker
I'm working on an app using react-rails / webpacker, with a rails server and React frontend. On top of this, we are also using styled-components and have overwritten the existing ReactRailsUJS.serverRender method in the…

Kris Alnes
- 11
- 3
1
vote
1 answer
Why does `React.renderToNodeStream` not yield to the event loop?
I'm trying to make React's renderToString and renderToStaticMarkup a better citizen by yielding to the event loop allowing other server requests to get a look in, e.g.
const React = require('react');
const { renderToNodeStream } =…

Richard Scarrott
- 6,638
- 1
- 35
- 46
1
vote
2 answers
React Server Side Rendering + renderToString
I am currently working on a new project, so I decided to implement React but with server side rendering.
I use express as router between pages, so when you access to the home page, the entry point is something like this:
const router =…

Valentin Reviglio
- 33
- 3
- 5
1
vote
1 answer
Error with routing in isomorphic server-side react project
I am trying to build a project using an isomorphic server-side rendering react. For some reason, the project stopped starting after adding routing.
The browser throws the following error:
Error: Invariant failed: Browser history needs a DOM
Maybe…

Kiten
- 985
- 2
- 17
- 35
1
vote
2 answers
ReactDOM Hydrate Renders HTML as Text on Client Page
I am trying to do a simple test and I know I am missing something simple.
I have two applications, one hosted on node (localhost:3000) and another is hosted on another site (http://development.azure). The section site is not running under node, its…

ps_md
- 209
- 2
- 10
1
vote
2 answers
How do I take a screenshot of a React component without mounting it in the DOM?
My use case is: I have a web site editor and a list of available web pages for users. Each page in this list is represented by a thumbnail. Every time a user makes a change to a page using the editor, the thumbnail of the respective site has to be…

Rafael Rozon
- 2,639
- 1
- 15
- 27
1
vote
0 answers
React Server side rendering (renderToString failed ):window is not defined
Here is Rendering method:
const makeUniversalHTML = (req, res, preloadedState) => {
const App = require('../../client/App')
const store = configureStore(preloadedState)
const context = {}
const html = renderToString(

I.ali
- 201
- 1
- 3
- 12
1
vote
0 answers
Error when importing SCSS in a React component rendered using HtmlWebpackPlugin
We'd like to render one of our React components to static HTML, so it's in the index.html returned by the server.
Rather than the code doing this while the server is being started, we'd rather the HtmlWebpackPlugin render the React component into…

Calum James
- 23
- 4
1
vote
0 answers
Routing and rendering React components server-side
I'm having a very difficult time trying to figure out what we should do to make React isomorphic. I'm following some tutorials and that's what I have right now:
I created a server.js file that starts an Express server
I created a router.js file…

Victor Ferreira
- 6,151
- 13
- 64
- 120
1
vote
0 answers
Best way to improve React Server Side Rendering by avoiding NODE_ENV checks
I am using require('babel-register') to allow for ES6 in node.js and doing server-side rendering of my react components.
In this talk (start around 7:14)
https://youtu.be/PnpfGy7q96U?t=7m14s
one main recommendation to speed up React Server Side…

Ish
- 1,855
- 5
- 24
- 32
1
vote
2 answers
Server-side rendering with React - composability => passing child component to parent
Just wondering if this is possible.
I have a parent component like so:
const React = require('react');
module.exports = React.createClass({
render: function(){
return (

Alexander Mills
- 90,741
- 139
- 482
- 817
0
votes
0 answers
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 so if anyone can point me in the right direction…

anterrysocial
- 13
- 3
0
votes
1 answer
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 of a component.
Can't I pass a…

Lekan Lawal
- 1
- 1
0
votes
1 answer
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") & "react-image-gallery": "~1.2.11" and when I try to build (with astro build) the astro app I get this error from the ImageGallery…

menepet
- 796
- 13
- 17