React Introduction
The React filter enables you to build React components.
The examples below are based on examples from the React website. For best results:
-
Review the React website first, and refer to it as you work through each example that follows. Compare the Ruby source and the JavaScript that is generated from these pages.
-
Change the Ruby source code in your browser and see how the JavaScript and results change.
Examples
As you go through these examples, you will see that there are multiple ways to do things (for example, three ways to express HTML, two ways to access state). This enables you to chose between adopting a more JavaScript/JSX style or a more Ruby/Markaby/builder style. Feel free to mix and match the various approaches, even within the scope of a single method.