Re:Vue.js 1.0.0
by bradstewart on Tuesday October 27, 2015 @01:53AM
(#10456502)
See 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.
Re:Vue.js 1.0.0
by cristianpascu on Tuesday October 27, 2015 @03:45AM
(#10456741)
Just 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.
Having 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.
After using React with Redux i can't even go back to plain Flux stores.
I'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?
Re:Vue.js 1.0.0
by andrezsanchez on Tuesday October 27, 2015 @12:25AM
(#10456312)
It 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.
It has: https://facebook.github.io/jsx/
Re:Vue.js 1.0.0
by andrezsanchez on Tuesday October 27, 2015 @02:12AM
(#10456553)
Emphasis 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.
You can use babel. Look at the custom example here: http://babeljs.io/docs/advanced/transformers/other/react/
Well, you could fork it:
There are alternatives though, like JSX implemented in sweet.js: http://jlongster.com/Compiling-JSX-with-Sweet.js-using-Readt...
There are babel transforms for it: https://github.com/openjsx
In fact I've seen a user use JSX-to-HTML for his Vue templates.
Evan:
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.
I 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.
What 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.
I'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/
Funny thing is, I switch away from React if I have much DOM manipulation and only use it for the "normal" stuff, like forms.
Yeah, 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)
Re:Vue.js 1.0.0
by aug-riedinger on Friday October 30, 2015 @02:26PM
(#10479581)
I 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 !
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.