Open
Description
First of all thanks for the greatly structured library.
I was trying to find a way to use custom components (like React.createElement):
class Item:
def __init__(self, attrs, *args, **kwargs):
self.attrs = attrs
def render(self):
check = '[x]' if self.attrs['done'] else '[ ]'
return li([check, ' ', self.attrs['title']])
def List():
return div(
ul([
h(Item, title='Todo 1', done=True),
h(Item, title='Todo 2', done=False),
])
)
Which renders:
<div>
<ul>
<li>[x] Todo 1</li>
<li>[ ] Todo 2</li>
</ul>
</div>
Seems like I need to alter the h function to do so. Am I correct?
Thanks in advance!
Metadata
Metadata
Assignees
Labels
No labels