DEV Community

Discussion on: React functional components: const vs. function

Collapse
 
ugglr profile image
Carl-W

As far as I can find there's no performance benefit to either syntax, I was hoping there was when I was looking it up.

I don't understand the last comment, I have never heard anybody say/write one over the other is cool. It's just syntax.

Collapse
 
ashm_18 profile image
ash-m

I assume "this" means "react". My guess is Anton is saying, "the only reason people use react is because it makes us look cool."

Thread Thread
 
antonofthewoods profile image
Anton Melser

Not at all, I mean declaring functions in consts when there is a perfectly "normal" way to do it that corresponds with how the majority of languages prefer to do it (ie, with the function keyword or equivalent).

Many languages have the ability to create functions and store them in "normal variables" but I'm not aware of any popular ones that prefer (in terms of lots of people using it) this syntax over "normal function declarations" for "normal" situations. As it provides no added value in 99% of the cases people use it in, it's just... (insert insult here).

And React is cool :-) (though lots of other JS platforms are probably too...)