Closed jvanbruegge closed 7 years ago
snabbdom-pragma
is just a wrapper from React.createElement
API to Snabbdom/h
.
So, all your jsx code will be transpiled to Snabbdom.createElement
which call h
.
Basically, if svg work with Snabbdom/h
it will work with snabbdom-pragma
BUT I will try with https://github.com/snabbdom/snabbdom/tree/master/examples/svg before giving you any final answer.
Here we go !
You can look a small example here : Swizz/snabbdom-pragma-examples The working example : https://swizz.github.io/snabbdom-pragma-examples/ (interact with eyes)
It working fine, but snabbdom-pragma
use the props
module by default which is not compatible with the svg one.
So, you need to use the attrs
module.
You can use it by the following :
<circle attrs-cx="43.5" attrs-cy="23" attrs-r="5"/>
If this syntax isnt good to you, and you prefer choosing between the props or attrs module at start, I can improve this !
Why not set both? When using DOM Nodes only the props are used for updating. When using svg the attrs are used.
Setting both at the same time ? Or do I need some conditionals for specifics svg tags ?
In fact the attrs
module seem greatest than the props
one. I will consider to use attrs
everywhere.
The problem is that attrs is not updating after the initial set. You will have to set both, but you shouldnt need any conditionals
1.8.0 is now out ! And npm published.
I apologize for the delay.
Thanks
As this is my biggest pain point with snabbdom-jsx. If yes, I will switch to this one