mantrajs / mantra-sample-blog-app

A sample blog app built with Mantra
http://mantra-sample-blog-app.herokuapp.com/
MIT License
296 stars 104 forks source link

Beginner Questions #78

Closed merlinstardust closed 8 years ago

merlinstardust commented 8 years ago

Why is React imported in some files but not used?

Why does core/components/newpost.jsx use React.createClass but core/components/postlist and core/components/post do not?

In the Meteor tutorial, the App gets rendered with React.render(<App />, document.getElementById("render-target"));, but in Mantra, this code is nowhere. So I would assume it gets replaced by app.init(). But in mantra-core, there is no React.render. So how is it being rendered?

arunoda commented 8 years ago

In core/components/postlist we use React's stateless components. With that, even though we don't use React on the code, it'll add when converting this code to normal JS.

That's why we need it.


Rendering

It's rendered in routes. See: https://github.com/mantrajs/mantra-sample-blog-app/blob/master/client/modules/core/routes.jsx (We use react-mounter for that)

merlinstardust commented 8 years ago

Thanks @arunoda!