react-templates/playground/examples.rt

43 lines
2.0 KiB
Plaintext
Raw Normal View History

2014-12-02 15:57:18 +01:00
<!doctype rt playground="./playground">
<div id="examples">
<div class="example">
2014-12-03 17:44:57 +01:00
<h3>Hello world in react templates</h3>
2014-12-02 15:57:18 +01:00
<p>
2014-12-03 17:44:57 +01:00
Simple hello world html transformed into react javascript code
2014-12-02 15:57:18 +01:00
</p>
2014-12-03 17:44:57 +01:00
<playground id="helloExample" rt-props="this.state.samples[0]" direction="horizontal" style="display: block"></playground>
2014-12-02 15:57:18 +01:00
</div>
<div class="example">
<h3>A Stateful Component</h3>
<p>
In addition to taking input data (accessed via <code>this.props</code>), a
component can maintain internal state data (accessed via <code>this.state</code>).
When a component&#39;s state data changes, the rendered markup will be
updated by re-invoking <code>render()</code>.
</p>
<div id="timerExample"></div>
2014-12-03 17:44:57 +01:00
<playground id="example2" rt-props="this.state.samples[1]" direction="horizontal" style="display: block"></playground>
2014-12-02 15:57:18 +01:00
</div>
<div class="example">
<h3>An Application</h3>
<p>
Using <code>props</code> and <code>state</code>, we can put together a small Todo application.
This example uses <code>state</code> to track the current list of items as well as
the text that the user has entered. Although event handlers appear to be
rendered inline, they will be collected and implemented using event
delegation.
</p>
<div id="todoExample"></div>
2014-12-03 17:44:57 +01:00
<playground id="example3" direction="horizontal" style="display: block"></playground>
2014-12-02 15:57:18 +01:00
</div>
<div class="example">
<h3>A Component Using External Plugins</h3>
<p>
React is flexible and provides hooks that allow you to interface with
other libraries and frameworks. This example uses Showdown, an external
Markdown library, to convert the textarea&#39;s value in real-time.
</p>
<div id="markdownExample"></div>
2014-12-03 17:44:57 +01:00
<playground id="example4" direction="horizontal" style="display: block"></playground>
2014-12-02 15:57:18 +01:00
</div>
</div>