Closed myyellowshoe closed 8 years ago
Contrary to your description, both mantra g component core:messages
and mantra g container core:messages
will generate a component looking like the following:
import React from 'react';
const Messages = () => (
<div>
Messages
</div>
);
export default Messages;
To generate the component of the first form in your question, you need to use --use-class
option. See README.
The distinction between the two types of components is whether they have states or not. The first may have states while the latter cannot. Avoiding the first when you can is considered a good practice. You can read more here.
Please re-open if there is an issue. A good place to discuss Mantra related topics is https://talk.mantrajs.com/.
Snap. You're right. My bad on that. Appreciate the link I'll check that out.
I noticed 2 ways components are built one way depending on how you generate them. I'm still a newb in this area I'll completely admit that, so there might be a perfectly good reason for this discrepancy. If its the case why is that? Whats the benefit of using one way over the other?
mantra g component core:messages
vs
mantra g container core:messages Generates container and following component