Document the JSX transpiler

This commit is contained in:
Alessandro Molina 2016-04-09 22:23:20 +02:00
parent 331a81b723
commit 361d21ac00
1 changed files with 12 additions and 0 deletions

View File

@ -121,6 +121,18 @@ in the browser, make sure to add
https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.6.1/polyfill.min.js
dependency.
JSX to Rect Transpiling
-----------------------
DukPy provides a built-in compiler from JSX to React, this is available as
``dukpy.jsx_compile``:
.. code:: python
>>> import dukpy
>>> dukpy.jsx_compile('var react_hello = <h1>Hello, world!</h1>;')
u'"use strict";\n\nvar react_hello = React.createElement(\n "h1",\n null,\n "Hello, world!"\n);'
Using the JavaScript Interpreter
--------------------------------