Remove examples/ folder (#9323)
This commit is contained in:
parent
04713fc4bd
commit
4a37718e4e
|
@ -9,7 +9,6 @@ docs/_site/
|
|||
docs/vendor/bundle/
|
||||
# This should be more like examples/**/thirdparty/** but
|
||||
# we should fix https://github.com/facebook/esprima/pull/85 first
|
||||
examples/
|
||||
fixtures/
|
||||
# Ignore built files.
|
||||
build/
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
[ignore]
|
||||
|
||||
<PROJECT_ROOT>/examples/.*
|
||||
<PROJECT_ROOT>/fixtures/.*
|
||||
<PROJECT_ROOT>/build/.*
|
||||
<PROJECT_ROOT>/.*/node_modules/y18n/.*
|
||||
|
|
|
@ -17,8 +17,6 @@ docs/.sass-cache
|
|||
docs/js/*
|
||||
docs/downloads/*.zip
|
||||
docs/vendor/bundle
|
||||
examples/shared/*.js
|
||||
examples/**/bundle.js
|
||||
fixtures/dom/public/react-dom.js
|
||||
fixtures/dom/public/react.js
|
||||
test/the-files-to-test.generated.js
|
||||
|
|
|
@ -115,7 +115,7 @@ We recommend running `npm test` (or its variations above) to make sure you don't
|
|||
|
||||
First, run `npm run build`. This will produce pre-built bundles in `build` folder, as well as prepare npm packages inside `build/packages`.
|
||||
|
||||
The easiest way to try your changes is to open and modify `examples/basic/index.html`. This file already uses `react.js` from the `build` folder so it will pick up your changes. Please make sure to rollback any unintentional changes in `examples` before sending a pull request.
|
||||
The easiest way to try your changes is to run `npm run build` and then open `fixtures/packaging/globals.html`. This file already uses `react.js` from the `build` folder so it will pick up your changes.
|
||||
|
||||
If you want to try your changes in your existing React project, you may copy `build/react.js`, `build/react-dom.js`, or any other build products into your app and use them instead of the stable version. If your project uses React from npm, you may delete `react` and `react-dom` in its dependencies and use `npm link` to point them to your local `build` folder:
|
||||
|
||||
|
|
|
@ -56,5 +56,3 @@ const proto = Object.create(HTMLElement.prototype, {
|
|||
});
|
||||
document.registerElement('x-search', {prototype: proto});
|
||||
```
|
||||
|
||||
You can also check out this [complete Web Components example on GitHub](https://github.com/facebook/react/tree/master/examples/webcomponents).
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
# React Examples
|
||||
|
||||
Here are some small React demos. Some use [JSX](https://facebook.github.io/react/docs/jsx-in-depth.html) and some include third-party library integration.
|
||||
|
||||
For more fully-featured examples, check out [React TodoMVC](http://todomvc.com/examples/react/) and [React + Backbone TodoMVC](http://todomvc.com/examples/react-backbone/).
|
|
@ -1,54 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Basic Click Counter Example with JSX</title>
|
||||
<link rel="stylesheet" href="../shared/css/base.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Basic Click Counter Example with JSX</h1>
|
||||
<div id="container">
|
||||
<p>
|
||||
To install React, follow the instructions on
|
||||
<a href="https://github.com/facebook/react/">GitHub</a>.
|
||||
</p>
|
||||
<p>
|
||||
If you can see this, React is <strong>not</strong> working right.
|
||||
If you checked out the source from GitHub make sure to run <code>grunt</code>.
|
||||
</p>
|
||||
</div>
|
||||
<h4>Example Details</h4>
|
||||
<p>This is written with JSX and transformed in the browser.</p>
|
||||
<p>This example uses events and state to track clicks and update the rendered output.</p>
|
||||
<p>
|
||||
Learn more about React at
|
||||
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
</p>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
|
||||
<script type="text/babel">
|
||||
var Counter = React.createClass({
|
||||
getInitialState: function () {
|
||||
return { count: 0 };
|
||||
},
|
||||
handleClick: function () {
|
||||
this.setState({
|
||||
count: this.state.count + 1,
|
||||
});
|
||||
},
|
||||
render: function () {
|
||||
return (
|
||||
<button onClick={this.handleClick}>
|
||||
Click me! Number of clicks: {this.state.count}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
});
|
||||
ReactDOM.render(
|
||||
<Counter />,
|
||||
document.getElementById('container')
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"presets": ["react", "es2015"]
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
# Basic example of using React with Browserify
|
||||
|
||||
Run `npm install` in the directory to install React from npm. Then run:
|
||||
|
||||
```sh
|
||||
npm start
|
||||
```
|
||||
|
||||
to produce `bundle.js` with example code and React.
|
|
@ -1,37 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Basic CommonJS Example with Browserify</title>
|
||||
<link rel="stylesheet" href="../shared/css/base.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Basic CommonJS Example with Browserify</h1>
|
||||
<div id="container">
|
||||
<p>
|
||||
To install React, follow the instructions on
|
||||
<a href="https://github.com/facebook/react/">GitHub</a>.
|
||||
</p>
|
||||
<p>
|
||||
If you can see this, React is <strong>not</strong> working right.
|
||||
If you checked out the source from GitHub make sure to run <code>grunt</code>.
|
||||
</p>
|
||||
</div>
|
||||
<h4>Example Details</h4>
|
||||
<p>This is written with JSX in a CommonJS module and precompiled to vanilla JS by navigating to the example
|
||||
directory
|
||||
<pre>cd /path/to/react/examples/example-name</pre>
|
||||
and running
|
||||
<pre>npm start</pre>
|
||||
<br>
|
||||
(don't forget to install first)
|
||||
<pre>npm install</pre>
|
||||
<br>
|
||||
</p>
|
||||
<p>
|
||||
Learn more about React at
|
||||
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
</p>
|
||||
<script src="bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,24 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var ReactDOM = require('react-dom');
|
||||
|
||||
var ExampleApplication = React.createClass({
|
||||
render: function() {
|
||||
var elapsed = Math.round(this.props.elapsed / 100);
|
||||
var seconds = elapsed / 10 + (elapsed % 10 ? '' : '.0' );
|
||||
var message =
|
||||
'React has been successfully running for ' + seconds + ' seconds.';
|
||||
|
||||
return <p>{message}</p>;
|
||||
}
|
||||
});
|
||||
|
||||
var start = new Date().getTime();
|
||||
|
||||
setInterval(function() {
|
||||
ReactDOM.render(
|
||||
<ExampleApplication elapsed={new Date().getTime() - start} />,
|
||||
document.getElementById('container')
|
||||
);
|
||||
}, 50);
|
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
"name": "react-basic-commonjs-example",
|
||||
"description": "Basic example of using React with CommonJS",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"babel-preset-es2015": "^6.6.0",
|
||||
"babel-preset-react": "^6.5.0",
|
||||
"babelify": "^7.3.0",
|
||||
"browserify": "^13.0.0",
|
||||
"react": "^15.0.2",
|
||||
"react-dom": "^15.0.2",
|
||||
"watchify": "^3.7.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "browserify ./index.js -t babelify -o bundle.js",
|
||||
"start": "watchify ./index.js -v -t babelify -o bundle.js"
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
var ExampleApplication = React.createClass({
|
||||
render: function() {
|
||||
var elapsed = Math.round(this.props.elapsed / 100);
|
||||
var seconds = elapsed / 10 + (elapsed % 10 ? '' : '.0' );
|
||||
var message =
|
||||
'React has been successfully running for ' + seconds + ' seconds.';
|
||||
|
||||
return <p>{message}</p>;
|
||||
}
|
||||
});
|
||||
|
||||
var start = new Date().getTime();
|
||||
|
||||
setInterval(function() {
|
||||
ReactDOM.render(
|
||||
<ExampleApplication elapsed={new Date().getTime() - start} />,
|
||||
document.getElementById('container')
|
||||
);
|
||||
}, 50);
|
|
@ -1,37 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Basic Example with External JSX</title>
|
||||
<link rel="stylesheet" href="../shared/css/base.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Basic Example with External JSX</h1>
|
||||
<div id="container">
|
||||
<p>
|
||||
If you can see this, React is <strong>not</strong> working right. This is probably because you're viewing
|
||||
this on your file system instead of a web server.<br>
|
||||
Try navigating to the React root
|
||||
<pre>
|
||||
cd /path/to/react
|
||||
</pre>
|
||||
and running
|
||||
<pre>
|
||||
python -m SimpleHTTPServer
|
||||
</pre>
|
||||
and going to <a href="http://localhost:8000/examples/basic-jsx-external/">http://localhost:8000/examples/basic-jsx-external/</a>.
|
||||
</p>
|
||||
</div>
|
||||
<h4>Example Details</h4>
|
||||
<p>This is written with JSX in a separate file and transformed in the browser.</p>
|
||||
<p>
|
||||
Learn more about React at
|
||||
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
</p>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
|
||||
<script type="text/babel" src="example.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,49 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Basic Example with JSX and ES6 features</title>
|
||||
<link rel="stylesheet" href="../shared/css/base.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Basic Example with JSX and ES6 features</h1>
|
||||
<div id="container">
|
||||
<p>
|
||||
To install React, follow the instructions on
|
||||
<a href="https://github.com/facebook/react/">GitHub</a>.
|
||||
</p>
|
||||
<p>
|
||||
If you can see this, React is <strong>not</strong> working right.
|
||||
If you checked out the source from GitHub make sure to run <code>grunt</code>.
|
||||
</p>
|
||||
</div>
|
||||
<h4>Example Details</h4>
|
||||
<p>This is written with JSX with Harmony (ES6) syntax and transformed in the browser.</p>
|
||||
<p>
|
||||
Learn more about React at
|
||||
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
</p>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
|
||||
<script type="text/babel">
|
||||
class ExampleApplication extends React.Component {
|
||||
render() {
|
||||
var elapsed = Math.round(this.props.elapsed / 100);
|
||||
var seconds = elapsed / 10 + (elapsed % 10 ? '' : '.0' );
|
||||
var message =
|
||||
`React has been successfully running for ${seconds} seconds.`;
|
||||
|
||||
return <p>{message}</p>;
|
||||
}
|
||||
}
|
||||
var start = new Date().getTime();
|
||||
setInterval(() => {
|
||||
ReactDOM.render(
|
||||
<ExampleApplication elapsed={new Date().getTime() - start} />,
|
||||
document.getElementById('container')
|
||||
);
|
||||
}, 50);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,19 +0,0 @@
|
|||
var ExampleApplication = React.createClass({
|
||||
render: function() {
|
||||
var elapsed = Math.round(this.props.elapsed / 100);
|
||||
var seconds = elapsed / 10 + (elapsed % 10 ? '' : '.0' );
|
||||
var message =
|
||||
'React has been successfully running for ' + seconds + ' seconds.';
|
||||
|
||||
return <p>{message}</p>;
|
||||
}
|
||||
});
|
||||
|
||||
var start = new Date().getTime();
|
||||
|
||||
setInterval(function() {
|
||||
ReactDOM.render(
|
||||
<ExampleApplication elapsed={new Date().getTime() - start} />,
|
||||
document.getElementById('container')
|
||||
);
|
||||
}, 50);
|
|
@ -1,40 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Basic Example with Precompiled JSX</title>
|
||||
<link rel="stylesheet" href="../shared/css/base.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Basic Example with Precompiled JSX</h1>
|
||||
<div id="container">
|
||||
<p>
|
||||
If you can see this, React is <strong>not</strong> running. Try running:
|
||||
</p>
|
||||
<pre>npm install -g babel-cli
|
||||
cd examples/basic-jsx-precompile/
|
||||
npm install babel-preset-react
|
||||
babel example.js --presets react --out-dir=build</pre>
|
||||
</div>
|
||||
<h4>Example Details</h4>
|
||||
<p>This is written with JSX in a separate file and precompiled to vanilla JS by running:</p>
|
||||
|
||||
<p><i>With Babel lower than 6.0</i></p>
|
||||
<pre>npm install -g babel
|
||||
cd examples/basic-jsx-precompile/
|
||||
babel example.js --out-dir=build</pre>
|
||||
|
||||
<p><i>With Babel 6.0 or higher</i></p>
|
||||
<pre>npm install -g babel-cli
|
||||
cd examples/basic-jsx-precompile/
|
||||
npm install babel-preset-react
|
||||
babel example.js --presets react --out-dir=build</pre>
|
||||
<p>
|
||||
Learn more about React at
|
||||
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
</p>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="build/example.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,49 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Basic Example with JSX</title>
|
||||
<link rel="stylesheet" href="../shared/css/base.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Basic Example with JSX</h1>
|
||||
<div id="container">
|
||||
<p>
|
||||
To install React, follow the instructions on
|
||||
<a href="https://github.com/facebook/react/">GitHub</a>.
|
||||
</p>
|
||||
<p>
|
||||
If you can see this, React is <strong>not</strong> working right.
|
||||
If you checked out the source from GitHub make sure to run <code>grunt</code>.
|
||||
</p>
|
||||
</div>
|
||||
<h4>Example Details</h4>
|
||||
<p>This is written with JSX and transformed in the browser.</p>
|
||||
<p>
|
||||
Learn more about React at
|
||||
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
</p>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
|
||||
<script type="text/babel">
|
||||
var ExampleApplication = React.createClass({
|
||||
render: function() {
|
||||
var elapsed = Math.round(this.props.elapsed / 100);
|
||||
var seconds = elapsed / 10 + (elapsed % 10 ? '' : '.0' );
|
||||
var message =
|
||||
'React has been successfully running for ' + seconds + ' seconds.';
|
||||
|
||||
return <p>{message}</p>;
|
||||
}
|
||||
});
|
||||
var start = new Date().getTime();
|
||||
setInterval(function() {
|
||||
ReactDOM.render(
|
||||
<ExampleApplication elapsed={new Date().getTime() - start} />,
|
||||
document.getElementById('container')
|
||||
);
|
||||
}, 50);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,52 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Basic Example</title>
|
||||
<link rel="stylesheet" href="../shared/css/base.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Basic Example</h1>
|
||||
<div id="container">
|
||||
<p>
|
||||
To install React, follow the instructions on
|
||||
<a href="https://github.com/facebook/react/">GitHub</a>.
|
||||
</p>
|
||||
<p>
|
||||
If you can see this, React is <strong>not</strong> working right.
|
||||
If you checked out the source from GitHub make sure to run <code>grunt</code>.
|
||||
</p>
|
||||
</div>
|
||||
<h4>Example Details</h4>
|
||||
<p>This is written in vanilla JavaScript (without JSX) and transformed in the browser.</p>
|
||||
<p>
|
||||
Learn more about React at
|
||||
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
</p>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script>
|
||||
var ExampleApplication = React.createClass({
|
||||
render: function() {
|
||||
var elapsed = Math.round(this.props.elapsed / 100);
|
||||
var seconds = elapsed / 10 + (elapsed % 10 ? '' : '.0' );
|
||||
var message =
|
||||
'React has been successfully running for ' + seconds + ' seconds.';
|
||||
|
||||
return React.DOM.p(null, message);
|
||||
}
|
||||
});
|
||||
|
||||
// Call React.createFactory instead of directly call ExampleApplication({...}) in React.render
|
||||
var ExampleApplicationFactory = React.createFactory(ExampleApplication);
|
||||
|
||||
var start = new Date().getTime();
|
||||
setInterval(function() {
|
||||
ReactDOM.render(
|
||||
ExampleApplicationFactory({elapsed: new Date().getTime() - start}),
|
||||
document.getElementById('container')
|
||||
);
|
||||
}, 50);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1 +0,0 @@
|
|||
NODE_PATH=../../../build/packages
|
|
@ -1,3 +0,0 @@
|
|||
.example {
|
||||
margin: 20px;
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>jQuery Integration</title>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="css/example.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="jqueryexample"></div>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
|
||||
<script src="http://code.jquery.com/jquery-2.2.2.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
|
||||
<script type="text/babel" src="js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,139 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
// Simple pure-React component so we don't have to remember
|
||||
// Bootstrap's classes
|
||||
var BootstrapButton = React.createClass({
|
||||
render: function() {
|
||||
return (
|
||||
<a {...this.props}
|
||||
href="javascript:;"
|
||||
role="button"
|
||||
className={(this.props.className || '') + ' btn'} />
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
var BootstrapModal = React.createClass({
|
||||
// The following two methods are the only places we need to
|
||||
// integrate Bootstrap or jQuery with the components lifecycle methods.
|
||||
componentDidMount: function() {
|
||||
// When the component is added, turn it into a modal
|
||||
$(this.refs.root).modal({backdrop: 'static', keyboard: false, show: false});
|
||||
|
||||
// Bootstrap's modal class exposes a few events for hooking into modal
|
||||
// functionality. Lets hook into one of them:
|
||||
$(this.refs.root).on('hidden.bs.modal', this.handleHidden);
|
||||
},
|
||||
componentWillUnmount: function() {
|
||||
$(this.refs.root).off('hidden.bs.modal', this.handleHidden);
|
||||
},
|
||||
close: function() {
|
||||
$(this.refs.root).modal('hide');
|
||||
},
|
||||
open: function() {
|
||||
$(this.refs.root).modal('show');
|
||||
},
|
||||
render: function() {
|
||||
var confirmButton = null;
|
||||
var cancelButton = null;
|
||||
|
||||
if (this.props.confirm) {
|
||||
confirmButton = (
|
||||
<BootstrapButton
|
||||
onClick={this.handleConfirm}
|
||||
className="btn-primary">
|
||||
{this.props.confirm}
|
||||
</BootstrapButton>
|
||||
);
|
||||
}
|
||||
if (this.props.cancel) {
|
||||
cancelButton = (
|
||||
<BootstrapButton onClick={this.handleCancel} className="btn-default">
|
||||
{this.props.cancel}
|
||||
</BootstrapButton>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="modal fade" ref="root">
|
||||
<div className="modal-dialog">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header">
|
||||
<button
|
||||
type="button"
|
||||
className="close"
|
||||
onClick={this.handleCancel}>
|
||||
×
|
||||
</button>
|
||||
<h3>{this.props.title}</h3>
|
||||
</div>
|
||||
<div className="modal-body">
|
||||
{this.props.children}
|
||||
</div>
|
||||
<div className="modal-footer">
|
||||
{cancelButton}
|
||||
{confirmButton}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
handleCancel: function() {
|
||||
if (this.props.onCancel) {
|
||||
this.props.onCancel();
|
||||
}
|
||||
},
|
||||
handleConfirm: function() {
|
||||
if (this.props.onConfirm) {
|
||||
this.props.onConfirm();
|
||||
}
|
||||
},
|
||||
handleHidden: function() {
|
||||
if (this.props.onHidden) {
|
||||
this.props.onHidden();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var Example = React.createClass({
|
||||
handleCancel: function() {
|
||||
if (confirm('Are you sure you want to cancel?')) {
|
||||
this.refs.modal.close();
|
||||
}
|
||||
},
|
||||
render: function() {
|
||||
var modal = null;
|
||||
modal = (
|
||||
<BootstrapModal
|
||||
ref="modal"
|
||||
confirm="OK"
|
||||
cancel="Cancel"
|
||||
onCancel={this.handleCancel}
|
||||
onConfirm={this.closeModal}
|
||||
onHidden={this.handleModalDidClose}
|
||||
title="Hello, Bootstrap!">
|
||||
This is a React component powered by jQuery and Bootstrap!
|
||||
</BootstrapModal>
|
||||
);
|
||||
return (
|
||||
<div className="example">
|
||||
{modal}
|
||||
<BootstrapButton onClick={this.openModal} className="btn-default">
|
||||
Open modal
|
||||
</BootstrapButton>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
openModal: function() {
|
||||
this.refs.modal.open();
|
||||
},
|
||||
closeModal: function() {
|
||||
this.refs.modal.close();
|
||||
},
|
||||
handleModalDidClose: function() {
|
||||
alert("The modal has been dismissed!");
|
||||
}
|
||||
});
|
||||
|
||||
ReactDOM.render(<Example />, document.getElementById('jqueryexample'));
|
|
@ -1,6 +0,0 @@
|
|||
jQuery Mobile React Example
|
||||
===========================
|
||||
|
||||
This example demonstrates how jQuery Mobile applications can be built with React.
|
||||
|
||||
The source code is based on jQuery Mobile's [pages-multi-page example](https://github.com/jquery/jquery-mobile/tree/master/demos/pages-multi-page).
|
|
@ -1,19 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>jQuery Mobile React Example</title>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-mobile/1.4.5/jquery.mobile.min.css" />
|
||||
<link rel="stylesheet" href="https://demos.jquerymobile.com/1.4.5/_assets/css/jqm-demos.css" />
|
||||
</head>
|
||||
<body class="ui-mobile-viewport ui-overlay-a">
|
||||
<div id="content"></div>
|
||||
<script src="http://code.jquery.com/jquery-2.2.2.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-mobile/1.4.5/jquery.mobile.min.js"></script>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,191 +0,0 @@
|
|||
/**
|
||||
* jQuery Mobile React Example
|
||||
*
|
||||
* Main application script.
|
||||
* For variety, this example is written in 100% JSHint-compliant JavaScript, not in JSX.
|
||||
*
|
||||
* Component structure:
|
||||
*
|
||||
* - App
|
||||
* |-- JQueryMobilePage (one)
|
||||
* | |-- JQueryMobileHeader
|
||||
* | |-- JQueryMobileContent
|
||||
* | | |-- PageOneContent
|
||||
* | | |-- JQueryMobileButton
|
||||
* | |-- JQueryMobileFooter
|
||||
* |-- JQueryMobilePage (two)
|
||||
* | |-- JQueryMobileHeader
|
||||
* | |-- JQueryMobileContent
|
||||
* | | |-- PageTwoContent
|
||||
* | | |-- JQueryMobileButton
|
||||
* | |-- JQueryMobileFooter
|
||||
* |-- JQueryMobilePage (popup)
|
||||
* |-- JQueryMobileHeader
|
||||
* |-- JQueryMobileContent
|
||||
* | |-- PagePopUpContent
|
||||
* | |-- JQueryMobileButton
|
||||
* |-- JQueryMobileFooter
|
||||
*/
|
||||
|
||||
/* global document, React */
|
||||
|
||||
'use strict';
|
||||
|
||||
/** Main application component. */
|
||||
var App = React.createClass({
|
||||
displayName: 'App',
|
||||
|
||||
render: function() {
|
||||
return React.DOM.div({className:'app'},
|
||||
JQueryMobilePage({id:'one'}, PageOneContent(null)),
|
||||
JQueryMobilePage({id:'two'}, PageTwoContent(null)),
|
||||
JQueryMobilePage({id:'popup', headerTheme:'b'}, PagePopUpContent(null))
|
||||
);
|
||||
}
|
||||
});
|
||||
App = React.createFactory(App);
|
||||
|
||||
/** jQuery Mobile button component. */
|
||||
var JQueryMobileButton = React.createClass({
|
||||
displayName: 'JQueryMobileButton',
|
||||
|
||||
getDefaultProps: function() {
|
||||
return {className:'ui-btn ui-shadow ui-corner-all'};
|
||||
},
|
||||
|
||||
render: function() {
|
||||
return React.DOM.p(null,
|
||||
React.DOM.a(this.props, this.props.children)
|
||||
);
|
||||
}
|
||||
});
|
||||
JQueryMobileButton = React.createFactory(JQueryMobileButton);
|
||||
|
||||
/** jQuery Mobile page content component. */
|
||||
var JQueryMobileContent = React.createClass({
|
||||
displayName: 'JQueryMobileContent',
|
||||
|
||||
render: function() {
|
||||
return React.DOM.div({role:'main', className:'ui-content'},
|
||||
this.props.children
|
||||
);
|
||||
}
|
||||
});
|
||||
JQueryMobileContent = React.createFactory(JQueryMobileContent);
|
||||
|
||||
/** jQuery Mobile footer component. */
|
||||
var JQueryMobileFooter = React.createClass({
|
||||
displayName: 'JQueryMobileFooter',
|
||||
|
||||
render: function() {
|
||||
return React.DOM.div({'data-role':'footer'},
|
||||
React.DOM.h4(null, 'Page footer')
|
||||
);
|
||||
}
|
||||
});
|
||||
JQueryMobileFooter = React.createFactory(JQueryMobileFooter);
|
||||
|
||||
/** jQuery Mobile header component. */
|
||||
var JQueryMobileHeader = React.createClass({
|
||||
displayName: 'JQueryMobileHeader',
|
||||
|
||||
render: function() {
|
||||
return React.DOM.div({'data-role':'header', 'data-theme':this.props.headerTheme},
|
||||
React.DOM.h1(null, this.props.title)
|
||||
);
|
||||
}
|
||||
});
|
||||
JQueryMobileHeader = React.createFactory(JQueryMobileHeader);
|
||||
|
||||
/** jQuery Mobile page component. */
|
||||
var JQueryMobilePage = React.createClass({
|
||||
displayName: 'JQueryMobilePage',
|
||||
|
||||
getDefaultProps: function() {
|
||||
return {'data-role':'page', 'data-theme':'a', headerTheme:'a'};
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var props = {};
|
||||
for (var key in this.props) {
|
||||
props[key] = this.props[key];
|
||||
}
|
||||
return React.DOM.div(props,
|
||||
JQueryMobileHeader({title:'Page ' + this.props.id, headerTheme:this.props.headerTheme}),
|
||||
JQueryMobileContent(null, this.props.children),
|
||||
JQueryMobileFooter(null)
|
||||
);
|
||||
}
|
||||
});
|
||||
JQueryMobilePage = React.createFactory(JQueryMobilePage);
|
||||
|
||||
/** Application page one component. */
|
||||
var PageOneContent = React.createClass({
|
||||
displayName: 'PageOneContent',
|
||||
|
||||
render: function() {
|
||||
return React.DOM.div(null,
|
||||
React.DOM.h2(null, 'One'),
|
||||
React.DOM.p(null,
|
||||
'I have an ',
|
||||
React.DOM.code(null, 'id'),
|
||||
' of "one" on my page container. I\'m first in the source order so I\'m shown when the page loads.'
|
||||
),
|
||||
React.DOM.p(null, 'This is a multi-page boilerplate template that you can copy to build your first jQuery Mobile page. This template contains multiple "page" containers inside, unlike a single page template that has just one page within it.'),
|
||||
React.DOM.p(null, 'Just view the source and copy the code to get started. All the CSS and JS is linked to the jQuery CDN versions so this is super easy to set up. Remember to include a meta viewport tag in the head to set the zoom level.'),
|
||||
React.DOM.p(null,
|
||||
'You link to internal pages by referring to the ',
|
||||
React.DOM.code(null, 'id'),
|
||||
' of the page you want to show. For example, to ',
|
||||
React.DOM.a({href:'#two'}, 'link'),
|
||||
' to the page with an ',
|
||||
React.DOM.code(null, 'id'),
|
||||
' of "two", my link would have a ',
|
||||
React.DOM.code(null, 'href="#two"'),
|
||||
' in the code.'
|
||||
),
|
||||
React.DOM.h3(null, 'Show internal pages:'),
|
||||
JQueryMobileButton({href:'#two'}, 'Show page "two"'),
|
||||
JQueryMobileButton({href:'#popup', 'data-rel':'dialog', 'data-transition':'pop'}, 'Show page "popup" (as a dialog)')
|
||||
);
|
||||
}
|
||||
});
|
||||
PageOneContent = React.createFactory(PageOneContent);
|
||||
|
||||
/** Application page two component. */
|
||||
var PageTwoContent = React.createClass({
|
||||
displayName: 'PageTwoContent',
|
||||
|
||||
render: function() {
|
||||
return React.DOM.div(null,
|
||||
React.DOM.h2(null, 'Two'),
|
||||
React.DOM.p(null, 'I have an id of "two" on my page container. I\'m the second page container in this multi-page template.'),
|
||||
React.DOM.p(null, 'Notice that the theme is different for this page because we\'ve added a few ',
|
||||
React.DOM.code(null, 'data-theme'),
|
||||
' swatch assigments here to show off how flexible it is. You can add any content or widget to these pages, but we\'re keeping these simple.'),
|
||||
JQueryMobileButton({href:'#one', 'data-direction':'reverse', className:'ui-btn ui-shadow ui-corner-all ui-btn-b'}, 'Back to page "one"')
|
||||
);
|
||||
}
|
||||
});
|
||||
PageTwoContent = React.createFactory(PageTwoContent);
|
||||
|
||||
/** Application popup page component. */
|
||||
var PagePopUpContent = React.createClass({
|
||||
displayName: 'PagePopUpContent',
|
||||
|
||||
render: function() {
|
||||
return React.DOM.div(null,
|
||||
React.DOM.h2(null, 'Popup'),
|
||||
React.DOM.p(null, 'I have an id of "popup" on my page container and only look like a dialog because the link to me had a ',
|
||||
React.DOM.code(null, 'data-rel="dialog"'),
|
||||
' attribute which gives me this inset look and a ',
|
||||
React.DOM.code(null, 'data-transition="pop"'),
|
||||
' attribute to change the transition to pop. Without this, I\'d be styled as a normal page.'),
|
||||
JQueryMobileButton({href:'#one', 'data-rel':'back', className:'ui-btn ui-shadow ui-corner-all ui-btn-inline ui-icon-back ui-btn-icon-left'}, 'Back to page "one"')
|
||||
);
|
||||
}
|
||||
});
|
||||
PagePopUpContent = React.createFactory(PagePopUpContent);
|
||||
|
||||
// Render application.
|
||||
ReactDOM.render(App(null), document.getElementById('content'));
|
|
@ -1,59 +0,0 @@
|
|||
var QuadraticCalculator = React.createClass({
|
||||
getInitialState: function() {
|
||||
return {
|
||||
a: 1,
|
||||
b: 3,
|
||||
c: -4
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* This function will be re-bound in render multiple times. Each .bind() will
|
||||
* create a new function that calls this with the appropriate key as well as
|
||||
* the event. The key is the key in the state object that the value should be
|
||||
* mapped from.
|
||||
*/
|
||||
handleInputChange: function(key, event) {
|
||||
var partialState = {};
|
||||
partialState[key] = parseFloat(event.target.value);
|
||||
this.setState(partialState);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var a = this.state.a;
|
||||
var b = this.state.b;
|
||||
var c = this.state.c;
|
||||
var root = Math.sqrt(Math.pow(b, 2) - 4 * a * c);
|
||||
var denominator = 2 * a;
|
||||
var x1 = (-b + root) / denominator;
|
||||
var x2 = (-b - root) / denominator;
|
||||
return (
|
||||
<div>
|
||||
<strong>
|
||||
<em>ax</em><sup>2</sup> + <em>bx</em> + <em>c</em> = 0
|
||||
</strong>
|
||||
<h4>Solve for <em>x</em>:</h4>
|
||||
<p>
|
||||
<label>
|
||||
a: <input type="number" value={a} onChange={this.handleInputChange.bind(null, 'a')} />
|
||||
</label>
|
||||
<br />
|
||||
<label>
|
||||
b: <input type="number" value={b} onChange={this.handleInputChange.bind(null, 'b')} />
|
||||
</label>
|
||||
<br />
|
||||
<label>
|
||||
c: <input type="number" value={c} onChange={this.handleInputChange.bind(null, 'c')} />
|
||||
</label>
|
||||
<br />
|
||||
x: <strong>{x1}, {x2}</strong>
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
ReactDOM.render(
|
||||
<QuadraticCalculator />,
|
||||
document.getElementById('container')
|
||||
);
|
|
@ -1,31 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Quadratic Formula Calculator</title>
|
||||
<link rel="stylesheet" href="../shared/css/base.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Quadratic Formula Calculator</h1>
|
||||
<div id="container">
|
||||
<p>
|
||||
If you can see this, React is <strong>not</strong> working right. This is probably because you're viewing
|
||||
this on your file system instead of a web server. Try running
|
||||
<pre>
|
||||
python -m SimpleHTTPServer
|
||||
</pre>
|
||||
and going to <a href="http://localhost:8000/">http://localhost:8000/</a>.
|
||||
</p>
|
||||
</div>
|
||||
<h4>Example Details</h4>
|
||||
<p>This is written with JSX in a separate file and transformed in the browser.</p>
|
||||
<p>
|
||||
Learn more about React at
|
||||
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
</p>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
|
||||
<script type="text/babel" src="example.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,62 +0,0 @@
|
|||
body {
|
||||
background: #fff;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 15px;
|
||||
line-height: 1.7;
|
||||
margin: 0;
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #4183c4;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
code {
|
||||
background-color: #f8f8f8;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 3px;
|
||||
font-family: "Bitstream Vera Sans Mono", Consolas, Courier, monospace;
|
||||
font-size: 12px;
|
||||
margin: 0 2px;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4 {
|
||||
font-weight: bold;
|
||||
margin: 0 0 15px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
border-bottom: 1px solid #ddd;
|
||||
font-size: 2.5em;
|
||||
font-weight: bold;
|
||||
margin: 0 0 15px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
border-bottom: 1px solid #eee;
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
p, ul {
|
||||
margin: 15px 0;
|
||||
}
|
||||
|
||||
ul {
|
||||
padding-left: 30px;
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Example with Transitions</title>
|
||||
<link rel="stylesheet" href="../shared/css/base.css" />
|
||||
<link rel="stylesheet" href="transition.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Example with Transitions</h1>
|
||||
<div id="container">
|
||||
<p>
|
||||
To install React, follow the instructions on
|
||||
<a href="https://github.com/facebook/react/">GitHub</a>.
|
||||
</p>
|
||||
<p>
|
||||
If you can see this, React is <strong>not</strong> working right.
|
||||
If you checked out the source from GitHub make sure to run <code>grunt</code>.
|
||||
</p>
|
||||
</div>
|
||||
<h4>Example Details</h4>
|
||||
<p>This is written with JSX and transformed in the browser.</p>
|
||||
<p>
|
||||
Learn more about React at
|
||||
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
</p>
|
||||
<script src="../../build/react-with-addons.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
|
||||
<script type="text/babel">
|
||||
var CSSTransitionGroup = React.addons.CSSTransitionGroup;
|
||||
var INTERVAL = 2000;
|
||||
|
||||
var AnimateDemo = React.createClass({
|
||||
getInitialState: function() {
|
||||
return {current: 0};
|
||||
},
|
||||
|
||||
componentDidMount: function() {
|
||||
this.interval = setInterval(this.tick, INTERVAL);
|
||||
},
|
||||
|
||||
componentWillUnmount: function() {
|
||||
clearInterval(this.interval);
|
||||
},
|
||||
|
||||
tick: function() {
|
||||
this.setState({current: this.state.current + 1});
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var children = [];
|
||||
var pos = 0;
|
||||
var colors = ['red', 'gray', 'blue'];
|
||||
for (var i = this.state.current; i < this.state.current + colors.length; i++) {
|
||||
var style = {
|
||||
left: pos * 128,
|
||||
background: colors[i % colors.length]
|
||||
};
|
||||
pos++;
|
||||
children.push(<div key={i} className="animateItem" style={style}>{i}</div>);
|
||||
}
|
||||
return (
|
||||
<CSSTransitionGroup
|
||||
className="animateExample"
|
||||
transitionEnterTimeout={250}
|
||||
transitionLeaveTimeout={250}
|
||||
transitionName="example">
|
||||
{children}
|
||||
</CSSTransitionGroup>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
ReactDOM.render(
|
||||
<AnimateDemo />,
|
||||
document.getElementById('container')
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,44 +0,0 @@
|
|||
.example-enter,
|
||||
.example-leave {
|
||||
-webkit-transition: all .25s;
|
||||
transition: all .25s;
|
||||
}
|
||||
|
||||
.example-enter,
|
||||
.example-leave.example-leave-active {
|
||||
opacity: 0.01;
|
||||
}
|
||||
|
||||
.example-leave.example-leave-active {
|
||||
margin-left: -128px;
|
||||
}
|
||||
|
||||
.example-enter {
|
||||
margin-left: 128px;
|
||||
}
|
||||
|
||||
.example-enter.example-enter-active,
|
||||
.example-leave {
|
||||
margin-left: 0;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.animateExample {
|
||||
display: block;
|
||||
height: 128px;
|
||||
position: relative;
|
||||
width: 384px;
|
||||
}
|
||||
|
||||
.animateItem {
|
||||
color: white;
|
||||
font-size: 36px;
|
||||
font-weight: bold;
|
||||
height: 128px;
|
||||
line-height: 128px;
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
-webkit-transition: all .25s; /* TODO: make this a move animation */
|
||||
transition: all .25s; /* TODO: make this a move animation */
|
||||
width: 128px;
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Basic Example with Web Components</title>
|
||||
<link rel="stylesheet" href="../shared/css/base.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Basic Example with Web Components</h1>
|
||||
<div id="container">
|
||||
<p>
|
||||
To install React, follow the instructions on
|
||||
<a href="http://www.github.com/facebook/react/">GitHub</a>.
|
||||
</p>
|
||||
<p>
|
||||
If you can see this, React is <strong>not</strong> working right.
|
||||
If you checked out the source from GitHub make sure to run <code>grunt</code>.
|
||||
</p>
|
||||
</div>
|
||||
<br /><br />
|
||||
<h4>Example Details</h4>
|
||||
<p>
|
||||
This example demonstrates Web Component / React Component interoperability
|
||||
by rendering a React Component, which renders a Web Component, which renders
|
||||
another React Component in the Web Component's shadow DOM.
|
||||
<p>
|
||||
<p>
|
||||
Learn more about React at
|
||||
<a href="http://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
</p>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/0.7.21/webcomponents.js"></script>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
|
||||
|
||||
<script type="text/babel">
|
||||
|
||||
// Define Web Component
|
||||
var proto = Object.create(HTMLElement.prototype, {
|
||||
attachedCallback: {
|
||||
value: function() {
|
||||
var mountPoint = document.createElement('span');
|
||||
this.createShadowRoot().appendChild(mountPoint);
|
||||
|
||||
var name = this.getAttribute('name');
|
||||
var url = 'https://www.google.com/search?q=' + encodeURIComponent(name);
|
||||
ReactDOM.render(<a href={url}>{name}</a>, mountPoint);
|
||||
}
|
||||
}
|
||||
});
|
||||
document.registerElement('x-search', {prototype: proto});
|
||||
|
||||
// Define React Component
|
||||
class HelloMessage extends React.Component {
|
||||
render() {
|
||||
return <div>Hello <x-search name={this.props.name} />!</div>;
|
||||
}
|
||||
}
|
||||
|
||||
// Mount React Component (which uses Web Component which uses React)
|
||||
var container = document.getElementById('container');
|
||||
ReactDOM.render(<HelloMessage name="Jim Sproch" />, container);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
NODE_PATH=../../build/packages
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
@ -0,0 +1,14 @@
|
|||
<html>
|
||||
<body>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="https://unpkg.com/babel-standalone@6/babel.js"></script>
|
||||
<div id="container"></div>
|
||||
<script type="text/babel">
|
||||
ReactDOM.render(
|
||||
<h1>Hello World!</h1>,
|
||||
document.getElementById('container')
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue