React 互动表单

前端之家收集整理的这篇文章主要介绍了React 互动表单前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

html:

<!DOCTYPE html>
<html>
    <head>
        <script src="https://fb.me/react-0.13.3.js"></script>
        <script src="https://fb.me/JSXTransformer-0.13.3.js"></script>
    </head>
    <body>
        <script type="text/jsx"> var Input = React.createClass({ getInitialState: function() { return {value: 'Hello!'}; },handleChange: function(event) { this.setState({value: event.target.value}); },render: function () { var value = this.state.value; return ( <div> <input type="text" value={value} onChange={this.handleChange} /> <p>{value}</p> </div> ); } }); React.render(<Input/>,document.body); </script>
    </body>
</html>
原文链接:https://www.f2er.com/react/307817.html

猜你在找的React相关文章