This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOMServer from 'react-dom/server'; | |
import express from 'express'; | |
import Html from './Html'; | |
import App from './App'; | |
const app = express(); | |
app.use('/static', express.static('public')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
const Html = (props) => { | |
return ( | |
<html> | |
<head> | |
<title>App</title> | |
</head> | |
<body> | |
<div id="app">{props.children}</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import App from './App'; | |
const initialData = JSON.parse(document.getElementById('initial-data').getAttribute('data-json')); | |
ReactDOM.render(<App {...initialData} />, document.getElementById('app')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOMServer from 'react-dom/server'; | |
import express from 'express'; | |
import Html from './Html'; | |
import App from './App'; | |
const app = express(); | |
app.use('/static', express.static('public')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
const Html = (props) => { | |
return ( | |
<html> | |
<head> | |
<title>App</title> | |
</head> | |
<body> | |
<div id="app" dangerouslySetInnerHTML={ {__html: props.markup} }></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
const App = (props) => { | |
return <div>Hello {props.name}</div>; | |
}; | |
export default App; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import TestRenderer from 'react-test-renderer'; | |
class MyComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
this.input = null; | |
} | |
componentDidMount() { | |
this.input.focus(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import TestRenderer from 'react-test-renderer'; | |
const Child = props => <div>{props.children}</div>; | |
const Counter = props => <div>{props.count}</div>; | |
class App extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import TestRenderer from 'react-test-renderer'; | |
const Text = (props) => <p>{props.children}</p>; | |
const App = () => ( | |
<section> | |
<h1>Hello</h1> | |
<Text>hogehoge</Text> | |
</section> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const React = require('react'); | |
const TestRenderer = require('react-test-renderer'); | |
const Child = props => <div>{props.children}</div>; | |
const Counter = props => <div>{props.count}</div>; | |
class App extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { |