Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react'
- import ReactDOM from 'react-dom'
- import ReactDOMServer from 'react-dom/server'
- class Navigation extends Component {
- render() {
- return (
- <ul>
- <li>Main</li>
- <li>About</li>
- <li>Other</li>
- </ul>
- )
- }
- }
- class HtmlPageTemplate extends Component {
- render() {
- return (
- <html lang="ru">
- <head>
- <title>Test page</title>
- <link type="content/style" href="style.css" />
- </head>
- <body>
- <h1 className="pageTitle">Hello world</h1>
- <p>Some text.</p>
- <Navigation />
- </body>
- </html>
- )
- }
- }
- const staticReactHtml = ReactDOMServer.renderToStaticMarkup(
- React.createElement(HtmlPageTemplate, null)
- )
- console.log('<!DOCTYPE html>\n' + staticReactHtml)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement