Questions tagged [react-universal]
14 questions
20
votes
2 answers
Is window.__INITIAL_STATE__ still the preferred way to pass initial state to the client in React Universal apps?
I'm currently reading a book about React and Universal apps in which the author claims that the following is best practice to pass initial state from server to client:
server.js
import React from 'react';
import {renderToStaticMarkup} from…

Timo Ernst
- 15,243
- 23
- 104
- 165
7
votes
3 answers
How to set Two inputs on same row in react native ?
Hey I want to set two textInputs on same line , named
Expiration date and CVV in android simulator.
Expiration date

Madhur
- 1,702
- 4
- 23
- 39
6
votes
0 answers
JWT authentication in Universal apps (server-side rendering)
Universal or server-side rendering composes a page before sending it to the client. At that point the user had no chance of submitting any credentials unless using cookies. JWT encourages using LocalStorage for storing the token instead of cookies,…

JayC
- 2,014
- 4
- 15
- 25
6
votes
3 answers
React SSR ReferenceError: document is not defined
I am having trouble to render react server side. I always get
^
ReferenceError: document is not defined
var root = document.getElementById('root');
I know what is happing that node dosen't understand browsers document object. But I cant…

jonjonson
- 263
- 2
- 5
- 16
5
votes
2 answers
How to get reference to store in react/redux?
In my reactjs-universal component I wrote this:
const mapStateToProps = (store) => {
return {
cars: store
}
}
export default connect(mapStateToProps)(SearchForm)
In the same component I would like to dispatch an action like :
…

bier hier
- 20,970
- 42
- 97
- 166
4
votes
1 answer
Critical dependency: the request of a dependency is an expression -- react-universal-component
Warning:
[HMR] bundle has 2 warnings
client.js:189 ./node_modules/babel-plugin-universal-import/universalImport.js 33:18-37
Critical dependency: the request of a dependency is an expression
@ ./src/routes/index.js
@ ./src/app-root.js
@ multi…

shet_tayyy
- 5,366
- 11
- 44
- 82
4
votes
2 answers
How to render data received from a REST service in React Universal? (Next.js)
I want to receive data via a REST service call in my React Universal (with Next.js) app using fetch() and then render the result into JSX like this:
class VideoPage extends Component {
componentWillMount() {
…

Timo Ernst
- 15,243
- 23
- 104
- 165
2
votes
1 answer
Using react-cookie in a util file
I am using react-cookie v2 in my react/redux app. To set a cookie you need to wrap the component in a HOC withCookies(component), then you can use this.props.cookies.set('first_cookie', someCookie); to set a cookie.
However, i would like to set my…

user3711421
- 1,658
- 3
- 20
- 37
1
vote
0 answers
React universal component throws error when connected to store
The errors occurs when trying to visit /article/post.... Here's a snippet of the code of Routes.js where supposedly the error happens. The full error stack trace is on https://pastebin.com/M0pCULPj The full repo is on…

El Anonimo
- 1,759
- 3
- 24
- 38
1
vote
1 answer
Why does react-routing not work directly in the browser?
I am using react-router 2.0 in my universal react app. Navigation trough the Link component works but when I paste the url manually nothing happens(browser hangs). How can I fix this issue? This is the router code:
…

bier hier
- 20,970
- 42
- 97
- 166
1
vote
1 answer
Different markup for server and client rendering
On the server we always want to show a verbose H1 for SEO reasons. However on mobile clients we want to show a shorter H1 due to the limited screen space.
This results in: Warning: React attempted to reuse markup in a container but the checksum was…

user3711421
- 1,658
- 3
- 20
- 37
0
votes
1 answer
React Loadable requesting new css in dynamically loaded components
I'm using react loadable to code split off components. I'm also using Extract CSS Chunks to split my stylesheets up. Everything works great during server side rendering and the initial client side render, but when I transition to a new page and a…

Thomas
- 2,356
- 7
- 23
- 59
0
votes
1 answer
How to use Stylesheets on React Server Side Rendererd App?
I am trying to convert my ReactJS application to Universal App with server-side rendering, but there is something that I don't understand. What is the best way to use and import styles to my components? Can I just import external stylesheet in HTML…

pureofpure
- 1,060
- 2
- 12
- 31
0
votes
1 answer
Component does not receive props (React SSR)
I have a fork of Redux saga boilerplate and I try to update store on the server side by action. It goes well, but the component does not update (don't call mapStateToProps) when the store was updated. What's wrong? Help, please.
Server log
Component…

R. Kolpakov
- 11
- 1