JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://unpkg.com/prop-types@15.5.10/prop-types.js"></script>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<div id="container"></div>
Babel + JSX
const range = count => new Array(count).fill();
class Child extends React.Component {
render() {
return (
<div>
Strings: {this.props.bigStrings.length}
</div>
);
}
}
class App extends React.Component {
state = {
bigStrings: []
}
componentDidMount() {
// Load some data
this.setState({
bigStrings: range(2000).map(i =>
range(10000).map(j =>
Math.random().toString(36)).join(''))
});
}
clearState = () => {
this.setState({ bigStrings: [] });
}
render() {
return (
<div>
<Child bigStrings={this.state.bigStrings} />
<button onClick={this.clearState}>Clear state</button>
</div>
);
}
}
ReactDOM.render(<App name="world"/>, document.getElementById('container'));