score:0
Accepted answer
if you just need data, you could send it along with the html file.
index.html:
<script>
var initialstate = /* have the server render some json here */
</script>
and then use "initialstate" to populate the first screen. if you are using redux you could use that variable as the initial state of your store. but as mentioned in the comments, redux is not necessary for this; arguably it makes it easier to do so.
for true server-side rendering you would actually send a full html page containing all html and data already to match exactly what your spa would generate.
Source: stackoverflow.com
Related Query
- How do I render React on the server with prerendered initial state?
- How can I make react render the new state modifications after I have updated the state with hooks and context
- React Server Side Rendering - how to render from the server with :productId params passed in?
- How to render the same component but with initial state (conditionally)?
- How do I use local state along with redux store state in the same react component?
- How to render images with react on server side?
- state inside useEffect refers the initial state always with React Hooks
- How to correctly set initial state in React with Typescript without constructor?
- How do you update Formik initial values with the react context api values after an AJAX request?
- How to test the state of a functional component in React with Jest (No Enzyme)
- How to optimize React components with React.memo and useCallback when callbacks are changing state in the parent
- React Router V4: How to render a modal in the same screen changing only the url and then with that url, be able to rebuild the whole screen
- How to change the state with React TypeScript 2.0?
- How to keep the React state in sync with MySQL database
- How can I render the react app with redux using the ReactJS.NET?
- How to pass input values from a child Form component to the state of its parent component for submission with react hooks?
- How do I Display Images in React which are downloaded as Files & saved in a Folder on the Server with the Filepath stored in my Database?
- How to access to a state in the render part with for loop?
- How to render server side react content with NextJS and React Router?
- How to not change the state at the first render of React component?
- How can I change the state of subcomponents with React Router?
- React Router v6 : How to render multiple component inside and outside a div with the same path
- How can the render be synced with the state on pagination click with react?
- How do I iterate though an array of objects with keys and values in react and render them in the JSX( Both keys and Values)
- React Router: How to render different components with the same route conditionally
- React : how to change the state of a button with an api call?
- In React with Formik how can I build a search bar that will detect input value to render the buttons?
- React - how to set state with the data from a resolved promise
- How to reinitialize the state with react hook when rerender the components
- How to define TypeScript types when used with React useState and the previous state inside a state updating function?
More Query from same tag
- Want to use String functions in the data returned from the API
- Why is my component not re-rendering after updating it?
- react.js - react-alert - Uncaught Invariant Violation: Invalid hook call
- Flowtype, React and defaultProps
- Using greater than with Lo Dash
- React - cloned repository npm install not working
- How do I tell tell a child element in React to seek its video element?
- Check for Component Prop in Styled Components
- Is there a way to trigger Material-UI Modal close manually
- Render a nested array of objects in react
- How to add new elements to table using ReactJS
- React: Update field values dynamically from separate input states
- NextJS Typescript - Setup tslint configuration to force error when have unused import/declarations
- React JS Events Not Firing for the Last rendered element
- Running ForceAtlas2 from a set position in Sigma.js
- Enzyme not working properly with react 16 (react create app)
- Conditional rendering of CSS style in elements React
- How can I copy a link id on a click using JS / React?
- How to change the hover colour on Office Fabric UI Nav component
- NextJS Dynamic Routing - Is it possible to set array of route names?
- React.js component not re-rendering children when the useState hook changes state
- React-Redux + Redux-Thunk on functional component. Update UI after data is fetched from API
- Remove inner padding border in Material UI Outlined Text Field
- Replace part of string with tag in JSX
- setting states in react component not class
- TypeError: Cannot read property 'map' of undefined react ant design table
- React - Display text messages in sections
- Firefox gives Network Error whereas other browsers work just fine (ReactJS App)
- Testing Custom Hook and useEffect Not Firing
- Looping over an object that is within a another object