11 ms·
I'm a little confused as to why the readme rants (entirely accurately) about text templating ... and then shows an example in react, which isn't using text temp
by mst 7y ago
I'm a little confused as to why the readme rants (entirely accurately) about text templating ... and then shows an example in react, which isn't using text templating at all.
In fact, the code jsx compiles into (which, yeah, you said no compilation in dev so that argument applies, sure) is not honestly that different to the JSON structure for the DOM, it's just made out of function calls rather than nested objects but the "returns what's basically a data structure" is still there.
(I'm mentioning this not to complain, but because it's so obviously Not Even Wrong that it looks like a brain fart and is probably worth correcting)
- tobiu 7y agoi am not super good at explaining this point. if components get complex (think about a buffered grid, the helix, the DatePicker with complex animations) you can end up with a huge amount of templates. you do not want to create massive amounts of child components (possible memory leaks), so you might end up with templates of several 100 lines and tons of if else. there is a trade off point where it is less and cleaner code to manually deal with the json structures. sure, you can also manually change the generated jsx output, but i would argue that you need to do it in a different way (not consistent), while you can do this the same way in neo throughout the cmp lifecylcle. now think about charts, like amCharts (just created the wrapper code): https://github.com/neomjs/neo/blob/dev/examples/charts/MainContainer.mjs https://github.com/neomjs/neo/blob/dev/examples/charts/MainC... putting the json config of a chart into the json component tree has its beauty. the same goes for mixing the json based cmp and vdom tree. (the chart lib runs inside the main thread while you define you chart inside the app worker). if many devs really want to use jsx with neo and accept a build process as the price, i would not mind if someone starts to work on making it happen. as long as it is optional.
- mst 7y agoYep, I absolutely see what you mean ... but the point here is you're talking about text templating, then you use a jsx example, which isn't text templating. I believe I understand what you're trying to say ... but the way you've said it ends up including a giant factual error that will potentially put people off. I figured it was "not super good at explaining" so thought I'd mention it so you could try and fix it (I'd be happy to help review an updated version, btw).
- tobiu 7y agoif you have an idea in mind, PRs are welcome :)