@@ -69,7 +69,7 @@ The object returned has two properties:
69
69
70
70
- ` markup ` - the rendered markup
71
71
- ` props ` - the JSON-serialized props
72
- - ` data ` - extra data returned by the render server
72
+ - ` data ` - the data returned by the render server
73
73
74
74
If the object is coerced to a string, it will emit the value of the ` markup ` attribute.
75
75
@@ -83,8 +83,6 @@ for a simple server that will cover most cases. The key files for the render ser
83
83
- [ render_server.js] ( examples/basic_rendering/render_server.js ) - the server's source code
84
84
- [ package.json] ( examples/basic_rendering/package.json ) - the server's dependencies, installable with
85
85
[ npm] ( http://npmjs.com )
86
-
87
- You can also return extra data from your render server and these data will be stored in ` data ` attribute of the response object.
88
86
89
87
90
88
Using React on the front-end
@@ -258,7 +256,7 @@ from react.conf import settings
258
256
DEBUG = True
259
257
260
258
settings.configure(
261
- RENDER = not DEBUG ,
259
+ RENDER = not DEBUG ,
262
260
RENDER_URL = ' http://127.0.0.1:9009/render' ,
263
261
)
264
262
```
@@ -273,7 +271,7 @@ INSTALLED_APPS = (
273
271
)
274
272
275
273
REACT = {
276
- ' RENDER' : not DEBUG ,
274
+ ' RENDER' : not DEBUG ,
277
275
' RENDER_URL' : ' http://127.0.0.1:8001/render' ,
278
276
}
279
277
```
@@ -303,6 +301,22 @@ Default: `'http://127.0.0.1:9009/render'`
303
301
Frequently Asked Questions
304
302
--------------------------
305
303
304
+ ### How do I return extra data from the render server?
305
+
306
+ You can edit the render server's code and annotate the returned payload with whatever data
307
+ that you like. The payload provided by the render server is available under the ` data ` attribute
308
+ of the response object.
309
+
310
+ For example:
311
+
312
+ ``` python
313
+ from react.render import render_component
314
+
315
+ rendered = render_component(' path/to/component.js' )
316
+
317
+ print (rendered.data)
318
+ ```
319
+
306
320
### Can python-react integrate with Django?
307
321
308
322
python-react can integrate with Django's settings and the renderer integration can
0 commit comments