4 ms·
This is a pretty cool library, for the people coming from React, the context switch for creating components needs not be so great: For a stateless component wh
by yomly 10y ago
This is a pretty cool library, for the people coming from React, the context switch for creating components needs not be so great:
For a stateless component which is implemented as a pure function, where you would normally write:
myPText(myText) {
return <p>{myText}</p>
}
In mithril you would write:
myPText(myText) {
return m("p", myText)
}
So the same vein of thinking can take you pretty far, but the benefit is that everything is Javascript so there is less context switching between framework and language!
EDIT: code snippet
- patricius 10y agoFurthermore, you can easily use JSX in Mithril the way you do in React, and in React you can also use the JavaScript syntax instead of JSX (e.g. React.DOM.div). Reference: http://mithril.js.org/jsx.html http://mithril.js.org/jsx.html