@@ -69,7 +69,7 @@ The object returned has two properties:
6969
7070 - ` markup ` - the rendered markup
7171 - ` props ` - the JSON-serialized props
72- - ` data ` - extra data returned by the render server
72+ - ` data ` - the data returned by the render server
7373
7474If the object is coerced to a string, it will emit the value of the ` markup ` attribute.
7575
@@ -83,8 +83,6 @@ for a simple server that will cover most cases. The key files for the render ser
8383 - [ render_server.js] ( examples/basic_rendering/render_server.js ) - the server's source code
8484 - [ package.json] ( examples/basic_rendering/package.json ) - the server's dependencies, installable with
8585 [ 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.
8886
8987
9088Using React on the front-end
@@ -258,7 +256,7 @@ from react.conf import settings
258256DEBUG = True
259257
260258settings.configure(
261- RENDER = not DEBUG ,
259+ RENDER = not DEBUG ,
262260 RENDER_URL = ' http://127.0.0.1:9009/render' ,
263261)
264262```
@@ -273,7 +271,7 @@ INSTALLED_APPS = (
273271)
274272
275273REACT = {
276- ' RENDER' : not DEBUG ,
274+ ' RENDER' : not DEBUG ,
277275 ' RENDER_URL' : ' http://127.0.0.1:8001/render' ,
278276}
279277```
@@ -303,6 +301,22 @@ Default: `'http://127.0.0.1:9009/render'`
303301Frequently Asked Questions
304302--------------------------
305303
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+
306320### Can python-react integrate with Django?
307321
308322python-react can integrate with Django's settings and the renderer integration can
0 commit comments