how to pass django params in react components

Viewed 143

i am new to react , i am building simple blog where user can post with title and body

in html its done with listview with:

{% for x in object_list %}
{% endfor %}

but in react component its not getting good result and showing error

here is my code:

models

class post(models.Model):
    title = models.CharField(max_length=100)
    body=models.TextField()

views

class list(ListView):
    model = post
    template_name = 'index.html'

post.js

function Post(){
return(
    {% for x in object_list %}
    {% endfor %}
)

}

in react what can i do to retreive data from model like we used to do in normal html, or show the object from model in components??

0 Answers
Related