I am just starting to learn ReactJS and am determining if its worth switching from AngularJS for use with Flask. I know one of the benefits of ReactJS is the way renderToString works to render and HTML string for faster load times and better SEO. From what I have read is the SEO is much better than what AngularJS can do although google is working to improve crawling Javascript.
My question is about how the SEO benefits would work with a Framework like Flask. Say I have a component like the one below and simply render it to my div. If I want to render this server side would I need to use something like nodejs or some Python library that can execute Javascript? If I try and do React.renderToString(.....) it doesn't do anything. If this is the case do the advertised benefits of SEO for ReactJS not really make it better than AngularJS? Please help me understand this and if its possible to render the Javascript Server Side with Flask about how may I go to achieve this?
var Foo = React.createClass({
render: function() {
return (
<div>Foo</div>
);
}
});
React.render(<Foo />, document.getElementById('foo'));
This is for Django rather than Flask but should be easy to adapt the underlying technique: https://github.com/markfinger/django-react
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With