Release 0.1.0 Esteban Castro Borsani

python-react-v8 Documentation

Release 0.1.0 Esteban Castro Borsani

August 19, 2016

Contents

1 User's Guide

1

1.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.3 Recipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.4 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 API Reference

5

2.1 API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3 Additional Notes

7

3.1 Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.2 License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

Python Module Index

9

i

ii

CHAPTER 1

User's Guide

1.1 Installation

1.1.1 Compatibility

What v8-cffi supports

1.1.2 Pip

Latest version can be installed through pip: $ pip install python-react-v8

1.2 Usage

1.2.1 Quick-start

import react react.set_up() react.utils.load_libs(['./bundle.js']) react_ = react.React({

'component': 'Counter', 'data': {'InitialCount': 10}}) react_.render() # Count: 10 First, we must call set_up(), this will initialize the V8 machinery. It must be call once in the program lifetime so it's a good idea to call it at import time or before starting the web-server. Then, we load the js bundle, it should be the same that is provided to the browser. Then, we create the React object, passing the parameters the underlying JS renderer function will receive. It must contain serializable (as json) keys and variables. Finally, we call the render() method, to run the JS renderer function and get its return value, which usually is a serializable object containing the rendered component and other extra data like an error message, redirection, etc.

1

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download