Earlier quoted context omitted.
Ternary operators should never be nested, whether you're using JSX or not. If you have that many conditionals you should use variables and/or decompose the optional pieces into sub-components. Pretty much any time you have a tag that has a huge number of attributes, it's a smell that you need to decompose something. Variable assignment is the simplest answer, which takes advantage of the fact that null or undefined v…
> Regarding class vs. className: class is a reserved word > in JS. It's not really a perf thing, it's the fact that > JSX was intended as a very simple transform. If JSX used > class instead of className, the transpiler would need to > be contextual since "class" would sometimes mean "css > class" and sometimes "JavaScript class". I don't think React should have used `class` instead of `className`, but this isn't the…
Our long term plan to make GitLab as fast as possible with Vue and Webpack
231–240 of 304 posts
Re: Our long term plan to make GitLab as fast as possible with Vue and Webpack
#232Earlier quoted context omitted.
Ternary operators should never be nested, whether you're using JSX or not. If you have that many conditionals you should use variables and/or decompose the optional pieces into sub-components. Pretty much any time you have a tag that has a huge number of attributes, it's a smell that you need to decompose something. Variable assignment is the simplest answer, which takes advantage of the fact that null or undefined v…
I think this proves lhorie's point. Markup syntax is dominated by code when you are building complex dynamic apps instead of static documents. What do you really gain by putting angle brackets around Avatar instead of calling a function? FWIW I believe new react devs are slow to realise they can use local variables like this because JSX looks like it is doing string templating instead of object instantiation.
const Dashboard = (props) => {
const {user} = props;
let link;
if (user) {
link = (
{user.name}
);
}
return (
{link}
...some other content...
);
};
If you want, you could create a `createProfileLink()` function, or you could create a `ProfileLink` component, or you could keep it as a variable in the `render()` function. This flexibility is what makes JSX powerful.Re: Our long term plan to make GitLab as fast as possible with Vue and Webpack
#233One of the biggest reasons I favor React is that it's much easier to add a templating language to a programming language (i.e. JSX) than the other way around. Every construct for making decisions based on your data, traversing your data, etc. is more cumbersome and harder to validate in handlebars or whatever identical looking templating language the community came up with this week. I also am strongly against string…
JSX frustrates me. When did we suddenly start thinking syntax was desirable again? When did the complexity of combining markup syntax and a programming language become a good idea? Why are we forcing this crazy complexity into every language and every IDE / code editor out there? I much prefer react with standard functions e.g. var element = DOM.p({id : "thing"}, DOM.div(), DOM.div()); You can use an API like this in…
Re: Our long term plan to make GitLab as fast as possible with Vue and Webpack
#234Earlier quoted context omitted.
I think this proves lhorie's point. Markup syntax is dominated by code when you are building complex dynamic apps instead of static documents. What do you really gain by putting angle brackets around Avatar instead of calling a function? FWIW I believe new react devs are slow to realise they can use local variables like this because JSX looks like it is doing string templating instead of object instantiation.
The example I gave was simplistic, but the value of JSX is the ability to easily nest elements. For instance, let's take my previous example and say we're creating a profile link: const Dashboard = (props) => { const {user} = props; let link; if (user) { link = ( {user.name} ); } return ( {link} ...some other content... ); }; If you want, you could create a `createProfileLink()` function, or you could create a `Profi…
There is nothing there that "makes JSX so powerful", its just hiding function calls and varargs. Its only xml-ish syntax. You are welcome to prefer it but its not adding anything functional beyond that.
const Dashboard = (props) => {
const {user} = props;
let link;
if (user) {
link =
DOM.a({href: "..."},
Components.Avatar(user),
DOM.span(user.name));
}
return
DOM.div(link, ...some other content);
};Re: Our long term plan to make GitLab as fast as possible with Vue and Webpack
#235Earlier quoted context omitted.
The example I gave was simplistic, but the value of JSX is the ability to easily nest elements. For instance, let's take my previous example and say we're creating a profile link: const Dashboard = (props) => { const {user} = props; let link; if (user) { link = ( {user.name} ); } return ( {link} ...some other content... ); }; If you want, you could create a `createProfileLink()` function, or you could create a `Profi…
> but the value of JSX is the ability to easily nest elements There is nothing there that "makes JSX so powerful", its just hiding function calls and varargs. Its only xml-ish syntax. You are welcome to prefer it but its not adding anything functional beyond that. const Dashboard = (props) => { const {user} = props; let link; if (user) { link = DOM.a({href: "..."}, Components.Avatar(user), DOM.span(user.name)); } ret…
It's okay if you prefer to write code using the direct function calls, but I'm not sure most people would agree with you. I've built a product using direct calls (in CoffeeScript) and using JSX, and JSX was far easier to work with and less error-prone. YMMV.
Re: Our long term plan to make GitLab as fast as possible with Vue and Webpack
#236Earlier quoted context omitted.
I don't know, that UI looks a little too "mobile first" to me (for something I would only use on my computer). EDIT: also, the colors seem quite dull from those screenshots
heh heh.. no real way to win. https://gitlab.com/gitlab-org/gitlab-ce/issues/6057
Re: Our long term plan to make GitLab as fast as possible with Vue and Webpack
#237React is an engineers overkill solution. JSX is bluck.
I use mithril.
Re: Our long term plan to make GitLab as fast as possible with Vue and Webpack
#238I'm not aware of the performance bottlenecks with GitLab, but are there any plans to speed up the backend as well, such as moving to a faster Ruby implementation?
We have no plans to move to another Ruby implementation, primarily because Ruby itself is not yet a bottleneck for us.
Could be looking at serious gains, 3x over CRuby looks to be a fairly reasonable goal when using RubyTruffle (slow startup times can be mitigated against with SubstrateVM), and if that's not an option due to it being a fairly new project, it seems like JRuby could give a decent performance boost too.
https://pragtob.wordpress.com/2015/11/30/benchmarking-a-go-a...
Re: Our long term plan to make GitLab as fast as possible with Vue and Webpack
#239but once you go vue, you will be very happy you did. i see a lot of ex-react devs who tell similar stories, myself.
with the sudden rise of vue and just how fast vue is gaining traction, given the trends and lifecycle of frameworks, i wouldnt be surprised if vue over takes react as de facto of frontend frameworks soon. it really makes development much pleasant and faster.
Re: Our long term plan to make GitLab as fast as possible with Vue and Webpack
#240Earlier quoted context omitted.
className was named that to avoid conflict with the JS class syntax originally I believe, since JSX is inline - they probably could put in the work to change it at this point, but it seems like a minimally beneficial change but massively disruptive at this point.
It was named that to match the DOM api[0], which React does whenever possible. The DOM api is probably named for the reason you state. [0]: https://developer.mozilla.org/en-US/docs/Web/API/Element/cla...