Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Tylor Steinberger
@TylorS
It has pretty much the same API as @motorcycle/mostly-dom
It doesn’t provide hyperscript though
Serge Havas
@Sinewyk
I mean, I just hit a problem for component in cyclejs, because null was passed through, and I was destructuring in my code, because the implementation was using default arguments (undefined !== null), but you don't use default arguments you use the || operator, so maybe it justs works
Ah
If we export the hyperscript primitive
this one h(tag, data, children)
then it's done
Configure the tsconfig.json and we're good to go \o/
Tylor Steinberger
@TylorS
import { h } from '@motorcycle/mostly-dom’ should be good
Serge Havas
@Sinewyk
Ah no, also broken
If h('div', null, []) for an empty div
Never mind
the probleme usually is for components
h(componentFunction, null, [])
but it doesn't support this apparently
Tylor Steinberger
@TylorS
Do you have a use case? I’ve just never needed it
Serge Havas
@Sinewyk
Well, it's just classic code, to avoid repetition
Like if you write react
Tylor Steinberger
@TylorS
It doesn’t seem like much more than componentFunction() that returns the view
Serge Havas
@Sinewyk
it is, it's just the difference between you yourself calling it
or your dom library doing it for you
<div><MyComponent/></div>
vs
Tylor Steinberger
@TylorS
I do use React and JSX at work, but we don’t use any class Foo extends Component so these things are a bit lost on me
Serge Havas
@Sinewyk
<div>{MyComponent()}</div>
Even if no classes
just props => <div/>
you don't support tagName being a function
typeof tagName === 'function' ? tagName(data, children) somewhere
and more precisely
typeof tagName === 'function' ? tagName(data === null ? {} : data, children)
to support destructuration
Tylor Steinberger
@TylorS
Yeah, I’m going to open an issue in mostly-dom for this
Serge Havas
@Sinewyk
It's just, my eyes are bleeding when directly manipulating hyperscript helpers, jsx makes it so much nicer IMO :)
Thanks for the talk =)
I'll try it soon =)
Tylor Steinberger
@TylorS
TylorS167/mostly-dom#50
Serge Havas
@Sinewyk
Nice, I would have added the special case that null needs to be transformed to {} to supports destructuration, since apparently all jsx transformers transform <Component/> to helper(Component, null, [])
Tylor Steinberger
@TylorS
:+1:
Serge Havas
@Sinewyk
Can I open a PR on this ?
Tylor Steinberger
@TylorS
Yes, that’d be great.
Serge Havas
@Sinewyk
Wow
Making that function polymorphic makes it so much harder haha
Serge Havas
@Sinewyk
I made a mistake
It's elm that has the h('div', data, []) API
jsx is h('div', data, ...children)
Serge Havas
@Sinewyk
The easiest thing to supports jsx would probably actually be to make a small wrapper for jsx
that then sends its arguments (reworked) to h itself
Kelly Thomas Kline
@kellytk
Pardon me if this isn't the correct channel for the suggestion, but I'd like to see something like most (or ReactiveX) Rx for Rust. Have you given any thought to that @tylors?
Frederik Krautwald
@Frikki
Hi @kellytk, I don’t understand what you’d like to see where. Motorcycle uses most/core streams.