Questions tagged [react-server]
36 questions
741
votes
32 answers
How to specify a port to run a create-react-app based project?
My project is based on create-react-app. npm start or yarn start by default will run the application on port 3000 and there is no option of specifying a port in the package.json.
How can I specify a port of my choice in this case? I want to run two…

letthefireflieslive
- 11,493
- 11
- 37
- 61
19
votes
2 answers
MJML - Template Interpolation, Dynamic Data, Context
After a lot of searches,
I am having difficulties in finding how:
MJML handles dynamic data and template interpolations
I was expecting something like:
import { mjml2html } from 'mjml';
const context = {
message: 'Hello World'
};
const view =…

Hitmands
- 13,491
- 4
- 34
- 69
13
votes
1 answer
how does one call a saga from within another saga?
When using redux-connect (the @asynConnect attribute) how does one chain a second saga, that is dependent on a successful completion of the first saga?
Just simply putting the saga dispatch action in at the appropriate location in the first saga…

Bennidhamma
- 730
- 1
- 7
- 17
6
votes
1 answer
Using csurf with react-server
I would like to add csurf as an express middleware inside the react-server for a universal app.
What I want to achieve is adding the csrf token to a hidden input in a form in the react component to maintain the same csrf protection flow a…

feychu
- 1,284
- 1
- 14
- 33
6
votes
0 answers
Require SVG cause react-server error: "React is not defined"
In a react-server project generated using generator-react-server loading SVG file like follow triggers a react error.
const fmc = require('../images/logo.svg');
Gives Error
Failed to load page at "../pages/home.js" ReferenceError: React is not…

svassr
- 5,538
- 5
- 44
- 63
5
votes
1 answer
Server rendered React ExpressJS frontend leaking users' Redux store data
I have an ExpressJS server that is sometimes rendering the wrong user's data on initial render. See a (slightly simplified) version below.
The issue is that the index.ejs file is often rendering the wrong user's data in reduxState...
My confusion is…

YPCrumble
- 26,610
- 23
- 107
- 172
5
votes
1 answer
How do I set headers the react-dom/server renderToString passes to graphql server?
I have a webserver which receives the client's IP from the load balancer via the X-Forwarded-For header, but does not forward it to the GraphQL server, making debugging more difficult.
Is it possible to turn this on, or would it require a patch to…

Andrey Fedorov
- 9,148
- 20
- 67
- 99
4
votes
2 answers
React Server-Side Rendering Memory Leak
The code below according to the link react says that:
Unfortunately, this can cause memory leaks for server rendering (where
componentWillUnmount will never be called)
// Before
class ExampleComponent extends React.Component {
…
user10803305
3
votes
1 answer
ReactDOMServer.renderToString is not a function
I render react component on server and when go to route get error message:
const renderToString = ReactDOMServer.renderToString
const fac = React.createFactory(React.createClass({
render: function() {
return (

Khotey Vitaliy
- 509
- 1
- 6
- 18
3
votes
0 answers
Server-side React rendering without Babel require hook
Is there any good way to use server-side rendering without Babel require hook?
Right now I'm using it to compile jsx on server and for ES6 module imports/exports (since they are not yet supported in Node.js). I think I can ditch imports/exports for…

Voice
- 1,547
- 16
- 31
2
votes
1 answer
Getting error "Could not find preset 'react-server' relative to directory ..."
Full error message:
../assets/around/TCircle.svg
Module build failed: Error: Couldn't find preset "react-server" relative to directory "/Users/admin/Documents"
at Array.map (native)
I'm getting the error above over and over, but there's no…

krmzv
- 387
- 3
- 14
2
votes
0 answers
Error configuring third-party wepack loaders with react-server
I am wondering if I could get some help on an error i am receiving with react server. I am trying to use the graphql-tag/loader with react-server and I don’t know how to proceed from the current error. The current setup is this: in my .reactserverrc…

zlegein
- 23
- 4
2
votes
0 answers
How do I pass JSON data from a Node.js res.render method to react.js on the client
I'm using node.js to accept a request, grab data from dynamodb, format/merge it into an existing JSON template object and return it.
This worked great when using node as a webservice and just returning json, but i'm testing writing new client side…

user3658383
- 21
- 4
1
vote
0 answers
how to build react js server side jpx and use it on client side with a php server?
I am quite new with React js and I'm pretty sure there are concepts that I am missing and fail to find the right answers to my questions.
So I have a simple php project running on nginx, I am wondering if I can somehow avoid using a webpack server…

Denis Makula
- 55
- 8
1
vote
0 answers
React Hydration - How can we hydrate a dynamic page that not fully available at build time?
I am building a website using Express and React. I go with Server-side rendering
Now I am looking for a solution to hydrate my final HTML.
The issue is at the build time, the page is still not available. A page only started with a main component and…

NHT
- 21
- 4