From 361d21ac00a62a9ded453c3f038cb9f38347dfe6 Mon Sep 17 00:00:00 2001 From: Alessandro Molina Date: Sat, 9 Apr 2016 22:23:20 +0200 Subject: [PATCH] Document the JSX transpiler --- README.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.rst b/README.rst index e10b0c8..7abc0b3 100644 --- a/README.rst +++ b/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 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 =

Hello, world!

;') + u'"use strict";\n\nvar react_hello = React.createElement(\n "h1",\n null,\n "Hello, world!"\n);' + Using the JavaScript Interpreter --------------------------------