facebookarchive / react-page

Easy Application Development with React JavaScript
Apache License 2.0
797 stars 72 forks source link

No way to add in doctype #37

Open pbeshai opened 10 years ago

pbeshai commented 10 years ago

There does not appear to be any way to add in a doctype to React pages. The included example SiteBoilerPlate does not include any, and at least I cannot figure out how to modify the JSX to allow it. Perhaps this could be an option for the react-page-middleware if JSX/React is insufficient?

jordwalke commented 10 years ago

I like the idea - something like a barebones HTML template skeleton?

pbeshai commented 10 years ago

That would be helpful. I came to this project looking for a way to allow me to use React for server-side rendering, which seems to involve writing the entire page template in React, but not being able to include the doctype is a bit unfortunate.

petehunt commented 10 years ago

@pbeshai You can always write a static HTML template and include the React markup within it, just not with react-page (you'd use plain old React + whatever server you want)

pbeshai commented 10 years ago

@petehunt I am currently doing that with Django running as the backend, but was considering switching to a nodejs backend if I could get the advantages of server-side rendering. Not sure how I do that without replicating the work done in react-page, but I admittedly have never looked into server-side js template rendering before.

petehunt commented 10 years ago

Check out https://github.com/petehunt/django-reactify/blob/master/django_reactify/__init__.py

Instead of returning the http response you could put the content right in a template.

pbeshai commented 10 years ago

@petehunt I think I misinterpreted you earlier - I am not including my React JSX code in my templates -- I mount them from a compiled js file. Django-reactify looks very interesting, I'll take a look. Thanks!