4 ms·
> More importantly, there’s no need to worry about calling $apply in a timeout, or calling setState(), or listening to store events Calling `setState` is not a
by lemevi 11y ago
> More importantly, there’s no need to worry about calling $apply in a timeout, or calling setState(), or listening to store events
Calling `setState` is not a big deal and neither is dealing with stores. It's very simple and you keep your state separate from your HTML.
At this point I probably can't do web development without JSX and not be miserable. The days of separate templates are hopefully forever behind me. Not trying to dismiss your very hard work I'm sure, but React has taken us into the future. Maybe with esperanto you could add templates into your own JS or make it work with JSX and react-dom.
- sdegutis 11y agoEvan: I'd love to know your response to lemevi here. In particular, what you consider the strengths and weaknesses to be in both your approaches, and why you prefer yours.
- andrezsanchez 11y agoIt would be neat if Facebook had implemented JSX as a framework-independent transform rather than a React-only one, that way other frameworks could use the pretty XMLish syntax rather than strings or JS objects.
- tiles 11y agoThere are alternatives though, like JSX implemented in sweet.js: http://jlongster.com/Compiling-JSX-with-Sweet.js-using-Readtables http://jlongster.com/Compiling-JSX-with-Sweet.js-using-Readt...
- rvikmanis 11y agoIt has: https://facebook.github.io/jsx/ https://facebook.github.io/jsx/
- andrezsanchez 11y agoEmphasis on "implemented" haha. At least this makes it more open since someone can come in and make their own implementation. As it currently stands I don't think you can use Facebook's implementation to transform JSX to a framework-agnostic object.
- EvanYou 11y agoThere are babel transforms for it: https://github.com/openjsx https://github.com/openjsx In fact I've seen a user use JSX-to-HTML for his Vue templates.
- bradstewart 11y agoSee http://vuejs.org/guide/application.html#Single_File_Components http://vuejs.org/guide/application.html#Single_File_Componen.... While it is certainly not JSX, Evan has written a Webpack loader, Browserify transform, and even a Sublime syntax highlighter to let you write JS, CSS, and HTML for a component in a single file. I personally like this approach as it lets me mix and match my favorite languages (Coffeescript, SASS, etc), and it makes plugging Vue into existing code a straightforward process.
- cristianpascu 11y agoJust yesterday I was looking for a solution to mix HTML, *Script and CSS preprocessors in one single file. So happy I found this project! There's hope.
- ocean3 11y agoAfter using React with Redux i can't even go back to plain Flux stores.
- hhsnopek 11y agoI disagree, I've never used jsx and I can still build web apps. There are plenty of templating languages to choose from, my choice is Jade. I actually have never touched React because I've never had so much DOM manipulation to make use of it. If anything I can smoothly update my DOM with marionette/backbone and a little css animation.
- Kiro 11y agoWhat are you disagreeing with exactly? They're not saying you can't build web apps without React and if you haven't even used React I don't see how you can make any judgement on that part.
- k__ 11y agoFunny thing is, I switch away from React if I have much DOM manipulation and only use it for the "normal" stuff, like forms.
- keithy 11y agoYeah, but the thing with React is that it's one library, instead of having both Jade and Backbone, you can have a fully React stack and have peace of mind through it. I've used Jade and honestly prefer the React way for sure because it combines the javascript with the html in the same file(s)
- rapind 11y agoI'm a fan of HAML / Slim / Jade too. You might want to check out React w/ CoffeeScript as it gets you pretty close (and has some benefits). It's not as pretty, but still better than JSX imo. I posted some examples here: http://rapin.com/blog/2015/02/03/reactjs-with-coffeescript/ http://rapin.com/blog/2015/02/03/reactjs-with-coffeescript/
- EvanYou 11y agoHaving to call `setState` kinda becomes a big deal when you want to separate state manipulation and make your components dumb. Both dirty checking and Virtual DOM are pull-based mechanisms - i.e. nothing happens when the state itself changes, you have to give the system a signal to pull and apply. This means when manipulating externalized state you need to hold a reference to all the components that are interested in it, or do it by registering events - which is why the original Flux is unnecessarily complex. It becomes less awkward when you have a single state atom, and that's why Redux is an improvement over vanilla Flux.
- feider 11y agoI'm not disagreeing, but when I hear "..., but React has taken us into the future." - is it just me or does this sound a bit too pompous?
- aug-riedinger 11y agoI actually don't understand how vue is different from react since the data flows the same way (besides different syntax and less jsx sugar, but preprocessable templates). More details on this from the author would be nice ! :) Good job anyway !