Closed nottledim closed 4 years ago
Hey you forgot to define viewTodos
const viewTodos = ({ data }) =>
<ul children=(data.todos.map(todo =>
<li>{todo}</li>
))/>;
Also you have to say witch elements do you want to use with
const { ul, li } = Moon.view.m
But for the next time rtfm
Yes, but I still get a syntax error with the full code (or your additions).
But for the next time rtfm
I'm trying
Thanks for your help.
In Moon, self closing tags must be specified with a closing />
. Also, arrow functions need parentheses around the return value if it's an object (this is a JS syntax thing, not moon).
Try this:
Moon.use({
data: Moon.data.driver,
view: Moon.view.driver("#root")
});
Moon.run(() => ({
data: [],
view: <viewTodos data=[]/>
}));
It probably was that closing tag, I didn't see that. It was code copied from a example in a blog. When I replaced it with the similar code on the moon website it worked. I misread the browser error message as an error with the library ;-) Live and learn. I'm sorry to have wasted your time.
@nottledim Don't worry about it! It took me a while to see the error too, the object return syntax always gets me. As for Moon, better syntax errors are coming in the next beta. Hope you enjoyed trying it out! :)
Using minimal snippet from example:
Results in: