You get a bonus - 1 coin for daily activity. Now you have 1 coin

What is ReactDOMServer? in REACT

Practice



ReactDOMServer
The object lets you render components to static markup (typically used on a Node server). This object is mainly used for server-side rendering (SSR). The following methods can be used in both the server and the browser environments:
  1. renderToString()
  2. renderToStaticMarkup()

For example, you would normally run a Node-based web server such as Express, Hapi or Koa, and call

renderToString
to render the root component into a string, which you then send as the response.
// using Express
import { renderToString } from 'react-dom/server'
import MyPage from './MyPage'

app.get('/', (req, res) => {
  res.write('<!DOCTYPE html><html><head><title>My Page</title></head><body>')
  res.write('<div id="content">')
  res.write(renderToString(<MyPage/>))
  res.write('</div></body></html>')
  res.end()
})

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Scripting client side JavaScript, jqvery, BackBone"

Terms: Scripting client side JavaScript, jqvery, BackBone