mirror of https://github.com/amol-/dukpy.git
Document the JSX transpiler
This commit is contained in:
parent
331a81b723
commit
361d21ac00
12
README.rst
12
README.rst
|
@ -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
|
https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.6.1/polyfill.min.js
|
||||||
dependency.
|
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
|
Using the JavaScript Interpreter
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
Loading…
Reference in New Issue