Use create-react-app for fixtures application

This moves the current fixture architecture to one based around create-react-app. There are a few important things to note:

* The react-loader.js script is always loaded before the bundle and will populate React and ReactDOM on the window. It is then read from the window by all components.
* The UI for the "React Sandbox" or "React Fixtures App" is also rendered with whatever version of React the user has selected. This means we dont have to deal with iframes or worry about multiple versions of React potentially interferring. But it also means that all components must be written using createClass to be fully backwards compatable. I tested back to 0.13.1 and it works fine.
This commit is contained in:
Brandon Dail
2017-01-06 17:10:41 -05:00
committed by Nathan Hunzaker
parent bf235489bf
commit 5deb9826ca
27 changed files with 5867 additions and 560 deletions
+15
View File
@@ -0,0 +1,15 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
node_modules
# testing
coverage
# production
build
# misc
.DS_Store
.env
npm-debug.log
+19
View File
@@ -0,0 +1,19 @@
{
"name": "_fixtures",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-scripts": "0.8.4"
},
"dependencies": {
"query-string": "^4.2.3",
"react": "^15.4.1",
"react-dom": "^15.4.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

+32
View File
@@ -0,0 +1,32 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<!--
Notice the use of %PUBLIC_URL% in the tag above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<script src="react-loader.js"></script>
</head>
<body>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start`.
To create a production bundle, use `npm run build`.
-->
</body>
</html>
@@ -7,8 +7,8 @@
* (Loads React 15.4.1)
*/
var REACT_PATH = '../../build/react.js';
var DOM_PATH = '../../build/react-dom.js';
var REACT_PATH = 'react.js';
var DOM_PATH = 'react-dom.js';
var BABEL_PATH = 'https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.19.0/babel.js';
function parseQuery(qstr) {
@@ -25,9 +25,11 @@ function parseQuery(qstr) {
return query;
}
var query = parseQuery(window.location.search.slice(1));
var query = parseQuery(window.location.search);
var version = query.version || 'local';
console.log(query)
if (version !== 'local') {
REACT_PATH = 'https://unpkg.com/react@' + version + '/dist/react.min.js';
DOM_PATH = 'https://unpkg.com/react-dom@' + version + '/dist/react-dom.min.js';
-82
View File
@@ -1,82 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Range Inputs</title>
<style>
* {
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
}
.hint,
input[type="range"] {
display: inline-block;
font-size: 14px;
padding: 4px;
vertical-align: middle;
}
.hint {
padding-left: 8px;
}
form {
max-width: 900px;
margin: 0 auto;
text-align: center;
}
fieldset {
border: 1px solid #ccc;
display: inline-block;
padding: 20px;
width: 45%;
}
</style>
</head>
<body>
<div id="container">Loading...</div>
<script src="../react-loader.js"></script>
<script type="text/babel">
class Test extends React.Component {
constructor (props, context) {
super(props, context)
this.state = { value: 0.5 }
}
onChange (event) {
this.setState({ value: event.target.value })
}
render() {
return (
<form>
<fieldset>
<legend>Controlled</legend>
<input type="range" value={this.state.value} onChange={this.onChange.bind(this)} />
<span className="hint">Value: {this.state.value}</span>
</fieldset>
<fieldset>
<legend>Uncontrolled</legend>
<input type="range" defaultValue={0.5} />
</fieldset>
</form>
)
}
}
ReactDOM.render(<Test />, document.getElementById('container'))
</script>
</body>
</html>
-84
View File
@@ -1,84 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Selects</title>
<style>
* {
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
}
form {
max-width: 900px;
margin: 0 auto;
text-align: center;
}
fieldset {
border: 1px solid #ccc;
display: inline-block;
padding: 20px;
width: 45%;
}
.hint {
padding-left: 8px;
}
</style>
</head>
<body>
<div id="container">Loading...</div>
<script src="../react-loader.js"></script>
<script type="text/babel">
class Test extends React.Component {
constructor (props, context) {
super(props, context)
this.state = { value: '' }
}
onChange (event) {
this.setState({ value: event.target.value })
}
render() {
return (
<form>
<fieldset>
<legend>Controlled</legend>
<select value={this.state.value} onChange={this.onChange.bind(this)}>
<option value="">Select a color</option>
<option value="red">Red</option>
<option value="blue">Blue</option>
<option value="green">Green</option>
</select>
<span className="hint">Value: {this.state.value}</span>
</fieldset>
<fieldset>
<legend>Uncontrolled</legend>
<select defaultValue="">
<option value="">Select a color</option>
<option value="red">Red</option>
<option value="blue">Blue</option>
<option value="gree">Green</option>
</select>
</fieldset>
</form>
)
}
}
ReactDOM.render(<Test />, document.getElementById('container'))
</script>
</body>
</html>
+19
View File
@@ -0,0 +1,19 @@
const React = window.React;
import Header from './Header';
import Fixtures from './fixtures';
import '../styles/App.css';
const App = React.createClass({
render() {
return (
<div>
<Header />
<div className="container" >
<Fixtures />
</div>
</div>
);
},
});
export default App;
+68
View File
@@ -0,0 +1,68 @@
import { parse, stringify } from 'query-string';
const React = window.React;
const Header = React.createClass({
getInitialState() {
const query = parse(window.location.search);
const version = query.version || 'local';
const versions = [version];
return { version, versions };
},
componentWillMount() {
fetch('http://api.github.com/repos/facebook/react/tags')
.then(res => res.json())
.then(tags => {
let versions = tags.map(tag => tag.name.slice(1));
versions = ['local', ...versions];
this.setState({ versions });
});
},
handleVersionChange(event) {
const query = parse(window.location.search);
query.version = event.target.value;
if (query.version === 'local') {
delete query.version;
}
window.location.search = stringify(query);
},
handleFixtureChange(event) {
window.location.pathname = event.target.value;
},
render() {
return (
<header className="header">
<div className="header__inner">
<span className="header__logo">
<img src="https://facebook.github.io/react/img/logo.svg" alt="" width="32" height="32" />
React Sandbox (v{React.version})
</span>
<div className="header-controls">
<label htmlFor="example">
<span className="sr-only">Select an example</span>
<select value={window.location.pathname} onChange={this.handleFixtureChange}>
<option value="/">Select a Fixture</option>
<option value="/range-inputs">Range Inputs</option>
<option value="/text-inputs">Text Inputs</option>
<option value="/selects">Selects</option>
<option value="/textareas">Textareas</option>
</select>
</label>
<label htmlFor="react_version">
<span className="sr-only">Select a version to test</span>
<select
value={this.state.version}
onChange={this.handleVersionChange}>
{this.state.versions.map(version => (
<option key={version} value={version}>{version}</option>
))}
</select>
</label>
</div>
</div>
</header>
);
},
});
export default Header;
+28
View File
@@ -0,0 +1,28 @@
const React = window.React;
const RangeInputs = React.createClass({
getInitialState() {
return { value: 0.5 };
},
onChange(event) {
this.setState({ value: event.target.value });
},
render() {
return (
<form>
<fieldset>
<legend>Controlled</legend>
<input type="range" value={this.state.value} onChange={this.onChange.bind(this)} />
<span className="hint">Value: {this.state.value}</span>
</fieldset>
<fieldset>
<legend>Uncontrolled</legend>
<input type="range" defaultValue={0.5} />
</fieldset>
</form>
);
},
});
export default RangeInputs;
+67
View File
@@ -0,0 +1,67 @@
const React = window.React;
import '../styles/TextInputs.css';
const TextInputFixtures = React.createClass({
getInitialState() {
return {
color: '#ffaaee',
};
},
renderControlled(type) {
let id = `controlled_${type}`;
let onChange = e => {
let value = e.target.value;
if (type === 'number') {
value = value === '' ? '' : parseFloat(value, 10) || 0
}
this.setState({
[type] : value,
});
};
let state = this.state[type] || '';
return (
<div key={type} className="field">
<label htmlFor={id}>{type}</label>
<input id={id} type={type} value={state} onChange={onChange} />
&nbsp; &rarr; {JSON.stringify(state)}
</div>
);
},
renderUncontrolled(type) {
let id = `uncontrolled_${type}`;
return (
<div key={type} className="field">
<label htmlFor={id}>{type}</label>
<input id={id} type={type} />
</div>
);
},
render() {
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input
let types = [
'text', 'email', 'number', 'url', 'tel',
'color', 'date', 'datetime-local',
'time', 'month', 'week', 'range', 'password',
];
return (
<form onSubmit={event => event.preventDefault()}>
<fieldset>
<legend>Controlled</legend>
{types.map(this.renderControlled)}
</fieldset>
<fieldset>
<legend>Uncontrolled</legend>
{types.map(this.renderUncontrolled)}
</fieldset>
</form>
);
},
});
module.exports = TextInputFixtures;
+28
View File
@@ -0,0 +1,28 @@
const React = window.React;
import RangeInputFixtures from './range-inputs';
import TextInputFixtures from './text-inputs';
import SelectFixtures from './selects';
import TextAreaFixtures from './textareas/';
/**
* A simple routing component that renders the appropriate
* fixture based on the location pathname.
*/
const FixturesPage = React.createClass({
render() {
switch (window.location.pathname) {
case '/text-inputs':
return <TextInputFixtures />;
case '/range-inputs':
return <RangeInputFixtures />;
case '/selects':
return <SelectFixtures />;
case '/textareas':
return <TextAreaFixtures />;
default:
return <span />;
}
},
});
module.exports = FixturesPage;
@@ -0,0 +1,28 @@
const React = window.React;
const RangeInputs = React.createClass({
getInitialState() {
return { value: 0.5 };
},
onChange(event) {
this.setState({ value: event.target.value });
},
render() {
return (
<form>
<fieldset>
<legend>Controlled</legend>
<input type="range" value={this.state.value} onChange={this.onChange.bind(this)} />
<span className="hint">Value: {this.state.value}</span>
</fieldset>
<fieldset>
<legend>Uncontrolled</legend>
<input type="range" defaultValue={0.5} />
</fieldset>
</form>
);
},
});
export default RangeInputs;
@@ -0,0 +1,37 @@
const React = window.React;
const SelectFixture = React.createClass({
getInitialState() {
return { value: '' };
},
onChange(event) {
this.setState({ value: event.target.value })
},
render() {
return (
<form>
<fieldset>
<legend>Controlled</legend>
<select value={this.state.value} onChange={this.onChange}>
<option value="">Select a color</option>
<option value="red">Red</option>
<option value="blue">Blue</option>
<option value="green">Green</option>
</select>
<span className="hint">Value: {this.state.value}</span>
</fieldset>
<fieldset>
<legend>Uncontrolled</legend>
<select defaultValue="">
<option value="">Select a color</option>
<option value="red">Red</option>
<option value="blue">Blue</option>
<option value="gree">Green</option>
</select>
</fieldset>
</form>
);
},
});
export default SelectFixture;
@@ -0,0 +1,67 @@
const React = window.React;
import '../../../styles/TextInputs.css';
const TextInputFixtures = React.createClass({
getInitialState() {
return {
color: '#ffaaee',
};
},
renderControlled(type) {
let id = `controlled_${type}`;
let onChange = e => {
let value = e.target.value;
if (type === 'number') {
value = value === '' ? '' : parseFloat(value, 10) || 0
}
this.setState({
[type] : value,
});
};
let state = this.state[type] || '';
return (
<div key={type} className="field">
<label htmlFor={id}>{type}</label>
<input id={id} type={type} value={state} onChange={onChange} />
&nbsp; &rarr; {JSON.stringify(state)}
</div>
);
},
renderUncontrolled(type) {
let id = `uncontrolled_${type}`;
return (
<div key={type} className="field">
<label htmlFor={id}>{type}</label>
<input id={id} type={type} />
</div>
);
},
render() {
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input
let types = [
'text', 'email', 'number', 'url', 'tel',
'color', 'date', 'datetime-local',
'time', 'month', 'week', 'range', 'password',
];
return (
<form onSubmit={event => event.preventDefault()}>
<fieldset>
<legend>Controlled</legend>
{types.map(this.renderControlled)}
</fieldset>
<fieldset>
<legend>Uncontrolled</legend>
{types.map(this.renderUncontrolled)}
</fieldset>
</form>
);
},
});
module.exports = TextInputFixtures;
@@ -0,0 +1,33 @@
const React = window.React;
const TextAreaFixtures = React.createClass({
getInitialState() {
return { value: '' };
},
onChange(event) {
this.setState({ value: event.target.value })
},
render() {
return (
<div className="container">
<form>
<fieldset>
<legend>Controlled</legend>
<textarea value={this.state.value} onChange={this.onChange.bind(this)} />
</fieldset>
<fieldset>
<legend>Uncontrolled</legend>
<textarea defaultValue="" />
</fieldset>
</form>
<h4>Controlled Output:</h4>
<div className='output'>
{this.state.value}
</div>
</div>
);
},
});
module.exports = TextAreaFixtures;
+8
View File
@@ -0,0 +1,8 @@
const React = window.React;
const ReactDOM = window.ReactDOM;
import App from './components/App';
ReactDOM.render(
<App />,
document.getElementById('root')
);
+94
View File
@@ -0,0 +1,94 @@
.App {
text-align: center;
}
.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 80px;
}
.App-header {
background-color: #222;
height: 150px;
padding: 20px;
color: white;
}
.App-intro {
font-size: large;
}
@keyframes App-logo-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
*,
*:before,
*:after {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
}
select {
width: 120px;
}
.header {
background: #222;
box-shadow: inset 0 -1px 3px #000;
overflow: hidden;
padding: 8px 16px;
line-height: 32px;
}
.header__inner {
display: table;
max-width: 1000px;
margin: 0 auto;
overflow: hidden;
text-align: center;
width: 100%;
}
.header__logo {
color: #efefef;
display: table-cell;
vertical-align: middle;
white-space: nowrap;
}
.header__logo img {
display: inline-block;
margin-right: 8px;
vertical-align: middle;
}
.header-controls {
display: table-cell;
text-align: right;
vertical-align: middle;
width: 100%;
}
iframe {
display: block;
height: 98%;
height: calc(100vh - 72px);
margin: 20px auto 0;
width: 100%;
}
.sr-only {
clip: rect(0, 0, 0, 0);
height: 0;
margin: -1px;
position: absolute;
width: 0;
}
+36
View File
@@ -0,0 +1,36 @@
* {
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
}
.container {
padding: 20px;
}
label {
display: block;
text-transform: uppercase;
letter-spacing: 0.01em;
font-size: 12px;
margin-bottom: 4px;
}
.field {
padding: 8px;
}
form {
max-width: 900px;
margin: 0 auto;
width: 100%;
}
fieldset {
border: 1px solid #aaa;
padding: 16px;
float: left;
width: 49%;
}
-182
View File
@@ -1,182 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>React Browser Sandbox</title>
<style>
*,
*:before,
*:after {
box-sizing: border-box;
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
}
.header {
background: #222;
box-shadow: inset 0 -1px 3px #000;
overflow: hidden;
padding: 8px 16px;
line-height: 32px;
}
.header__inner {
display: table;
max-width: 1000px;
margin: 0 auto;
overflow: hidden;
text-align: center;
width: 100%;
}
.header__logo {
color: #efefef;
display: table-cell;
vertical-align: middle;
white-space: nowrap;
}
.header__logo img {
display: inline-block;
margin-right: 8px;
vertical-align: middle;
}
.header-controls {
display: table-cell;
text-align: right;
vertical-align: middle;
width: 100%;
}
iframe {
display: block;
height: 98%;
height: calc(100vh - 72px);
margin: 20px auto 0;
width: 100%;
}
.sr-only {
clip: rect(0, 0, 0, 0);
height: 0;
margin: -1px;
position: absolute;
width: 0;
}
</style>
</head>
<body>
<header class="header">
<form method="GET" class="header__inner" id="form">
<span class="header__logo">
<img src="https://facebook.github.io/react/img/logo.svg" alt="" width="32" height="32" />
React Sandbox
</span>
<div class="header-controls">
<label for="example">
<span class="sr-only">Select an example</span>
<select id="example" name="example">
<option value="./text-inputs/index.html">Text Inputs</option>
<option value="./range-inputs/index.html">Range Inputs</option>
<option value="./selects/index.html">Selects</option>
<option value="./textareas/index.html">Textareas</option>
</select>
</label>
<label for="react_version">
<span class="sr-only">Select a version to test</span>
<select id="react_version" name="version">
<option value="local">Local</option>
</select>
</label>
</div>
</form>
</header>
<iframe id="frame" frameborder="0"></iframe>
<script>
var frame = document.querySelector('#frame');
var form = document.querySelector('#form');
var select = document.querySelector("#react_version");
var example = document.querySelector('#example');
function getVersion () {
var match = window.location.search.match(/version\=(.*?)($|&)/);
return unescape(match ? match[1] : select.value);
}
function getExample () {
var match = window.location.search.match(/example\=(.*?)($|&)/);
return unescape(match ? match[1] : example.value);
}
/**
* Populate the dropdown
*/
function addOptions (data) {
var version = getVersion();
JSON.parse(data).forEach(function(row) {
var option = document.createElement("option");
option.value = row.name.slice(1);
option.text = row.name;
select.options.add(option);
});
select.value = getVersion();
}
/**
* Fetch version information from Github
*/
function fetchOptions (callback) {
var request = new XMLHttpRequest();
request.onload = function () {
if (request.readyState == 4){
if (request.status >= 400) {
return console.error('Error ' + request.status + ': Something went wrong fetching React versions from Github.')
}
callback(request.responseText);
sessionStorage.options = request.responseText;
}
}
request.open('GET', "http://api.github.com/repos/facebook/react/tags");
request.send();
}
/**
* Update the UI with current selections
*/
frame.src = getExample() + '?' + window.location.search;
example.value = getExample();
form.addEventListener('change', function() {
form.submit();
});
if ('options' in sessionStorage) {
addOptions(sessionStorage.options);
} else {
fetchOptions(addOptions);
}
</script>
</body>
</html>
-120
View File
@@ -1,120 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Inputs</title>
<style>
* {
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
}
label {
display: block;
text-transform: uppercase;
letter-spacing: 0.01em;
font-size: 12px;
margin-bottom: 4px;
}
.field {
padding: 8px;
}
form {
max-width: 900px;
margin: 0 auto;
width: 100%;
}
fieldset {
border: 1px solid #aaa;
padding: 16px;
float: left;
width: 49%;
}
</style>
</head>
<body>
<div id="container">Loading...</div>
<script src="../react-loader.js"></script>
<script type="text/babel">
var Test = React.createClass({
getInitialState() {
return {
color: "#ffaaee"
}
},
renderControlled(type) {
let id = `controlled_${type}`
let onChange = e => {
let value = e.target.value
if (type === 'number') {
value = value == '' ? '' : parseFloat(value, 10) || 0
}
this.setState({
[type] : value
})
}
let state = this.state[type] || ''
return (
<div key={type} className="field">
<label htmlFor={id}>{type}</label>
<input id={id} type={type} value={state} onChange={onChange} />
&nbsp; &rarr; {JSON.stringify(state)}
</div>
)
},
renderUncontrolled(type) {
let id = `uncontrolled_${type}`
return (
<div key={type} className="field">
<label htmlFor={id}>{type}</label>
<input id={id} type={type} />
</div>
)
},
render() {
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input
let types = [
'text', 'email', 'number', 'url', 'tel',
'color', 'date', 'datetime-local',
'time', 'month', 'week', 'range', 'password'
]
return (
<form onSubmit={e=>e.preventDefault()}>
<fieldset>
<legend>Controlled</legend>
{types.map(this.renderControlled)}
</fieldset>
<fieldset>
<legend>Uncontrolled</legend>
{types.map(this.renderUncontrolled)}
</fieldset>
</form>
)
}
})
ReactDOM.render(<Test />, document.getElementById('container'))
</script>
</body>
</html>
-89
View File
@@ -1,89 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Textarea</title>
<style>
* {
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
}
textarea {
display: block;
min-height: 250px;
width: 100%;
}
.container {
max-width: 900px;
margin: 0 auto;
text-align: center;
}
.output {
word-wrap: break-word;
max-width: 780px;
margin: auto;
}
fieldset {
border: 1px solid #ccc;
display: inline-block;
padding: 20px;
vertical-align: top;
width: 45%;
}
</style>
</head>
<body>
<div id="container">Loading...</div>
<script src="../react-loader.js"></script>
<script type="text/babel">
class Test extends React.Component {
constructor (props, context) {
super(props, context)
this.state = { value: '' }
}
onChange (event) {
this.setState({ value: event.target.value })
}
render() {
return (
<div className='container'>
<form>
<fieldset>
<legend>Controlled</legend>
<textarea value={this.state.value} onChange={this.onChange.bind(this)} />
</fieldset>
<fieldset>
<legend>Uncontrolled</legend>
<textarea defaultValue="" />
</fieldset>
</form>
<h4>Controlled Output:</h4>
<div className='output'>
{this.state.value}
</div>
</div>
)
}
}
ReactDOM.render(<Test />, document.getElementById('container'))
</script>
</body>
</html>
+5283
View File
File diff suppressed because it is too large Load Diff