I have the following code snippet --
const clearButton = {
view: (_, args) =>
m('button', { onclick: args.clickAction }, 'Clear')
}
const helloWorld = {
view: (_, args) => [
m('h1', 'Hello World'),
m(clearButton, { clickAction: () => args.model('')}),
' ',
m('input', {
value: args.model(),
oninput: e => args.model(e.target.value)
}),
' You said: ' + args.model(),
m('ul', args.model().split('').map(c => m('li', c)))
]
}
m.mount(document.body, m(helloWorld, {
model: m.prop('')
}));
I get the error as m.prop() is not a function. I have imported mithril from a CDN --
<body>
<script src="https://unpkg.com/[email protected]/mithril.js"></script>
<script type="text/javascript" src="yousaid.js"></script>
</body>
m.prop was default on the old 0.2 version... look at the migration docs...
https://github.com/MithrilJS/mithril.js/blob/next/docs/change-log.md#migrating-from-v02x
basically you should use the mithril/stream in 1.*
@griebd Thanks. Am new to this coming from Angular 2 which is on the heavier side.
Most helpful comment
m.prop was default on the old 0.2 version... look at the migration docs...
https://github.com/MithrilJS/mithril.js/blob/next/docs/change-log.md#migrating-from-v02x
basically you should use the mithril/stream in 1.*