Django context to React component

35 views
Skip to first unread message

jose ivan perez diaz

unread,
Aug 2, 2020, 1:02:10 PM8/2/20
to Django users
Hi Everyone,
Where can I found a guide to combine django and React? I mean, what I want is passing the context to a React component, any clue?, I know that is possible combine them throw django rest framework through an API, but is it possible work with the context from django in React, thaks for your help.

Yemin Sajid

unread,
Aug 3, 2020, 5:07:29 AM8/3/20
to Django users
On idea could be serializing the context and setting as in a global `var` in javascript code in the templates. Then you should be able to access those in from React code.
But tbh, I would not recommend that. This type of integration may create unnecessary complexities.

Better to work with the API workflow.

jose ivan perez diaz

unread,
Aug 3, 2020, 7:54:21 AM8/3/20
to django...@googlegroups.com
Thanks for your advice 

Sent from my iPhone

On 3/08/2020, at 4:07 AM, Yemin Sajid <yemin...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b5113d31-9279-4670-a731-071633ff0cf2o%40googlegroups.com.

Yemin Sajid

unread,
Aug 3, 2020, 1:16:44 PM8/3/20
to django...@googlegroups.com
You're welcome.

Reply all
Reply to author
Forward
0 new messages