Skip to content

Rename "functional component" to "function component" #863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 4, 2018

Conversation

gaearon
Copy link
Member

@gaearon gaearon commented May 6, 2018

@reactjs-bot
Copy link

Deploy preview for reactjs ready!

Built with commit e825fe5

https://deploy-preview-863--reactjs.netlify.com

@reactjs-bot
Copy link

reactjs-bot commented May 6, 2018

Deploy preview for reactjs ready!

Built with commit c983324

https://deploy-preview-863--reactjs.netlify.com

@alexkrolick
Copy link
Collaborator

alexkrolick commented May 6, 2018

"Function component" sounds wrong grammatically. What about "component function" (and "component class" when talking about something extending React.Component")?

@gaearon
Copy link
Member Author

gaearon commented May 6, 2018

We do say “class component” so I don’t think it’s too different. Just a bit unusual.

@gaearon
Copy link
Member Author

gaearon commented May 6, 2018

Like “strawberry ice-cream”.

@alexkrolick
Copy link
Collaborator

Ok, as long as you stick to the ice cream analogy 😉

@sebmarkbage
Copy link
Contributor

How are they not functional? They have to be pure. Are supposed to be used with lazy evaluation in a monadic way.

Even with state they are pure because the state will be based on algebraic effects.

If anything not calling them functional is misleading since they follow a strict set of rules that all come from functional programming. Everything is functions, including classes.

@gaearon
Copy link
Member Author

gaearon commented May 7, 2018

Everything is functions, including classes.

That's the point, isn't it?

It's not that function components aren't functional-by-nature. It's that they're indeed all functional, including classes. Therefore saying "functional" to mean "a component that happens to be a function, as opposed to a class" doesn't mean as much sense. But that's exactly how we use the term right now, and what this PR could change.

This doesn't mean either of them stop being functional. Just that we can might prefer to use the word "functional" to mean the paradigm and overall approach, rather than the component definition syntax.

Tbh I can argue both ways for this.

@sebmarkbage
Copy link
Contributor

It's that they're indeed all functional, including classes.

That's not what I said. You conflated functional and functions. :) I said classes are functions. I'd argue that classes are not functional.

They're not because they get their arguments from mutations to props/state, not algebraic effects, and the instance has identity over time. (Any instance with identity over time in the functional form, is an escape like mutable refs in OCaml.)

@gaearon gaearon force-pushed the function-comp branch 2 times, most recently from 934fcd0 to 47b9e3d Compare October 4, 2018 21:07
@gaearon gaearon merged commit 81afcfb into reactjs:master Oct 4, 2018
@gaearon
Copy link
Member Author

gaearon commented Oct 4, 2018

(Chatted with @sebmarkbage and he's not opposed)

@TeoTN
Copy link

TeoTN commented Oct 7, 2018

Well, so called "functional components" have also another term that was in widespread use in the Internet being "stateless components". I guess the naming comes from people that felt something is not OK with calling them "functional" and we could use that. I mean, why to introduce yet another name?
Personally, during any workshops I was calling them either stateless or function, and I had to correct myself oftentimes when referring to them as functional, but out of these three I feel stateless gives the most accurate differentiation for beginners.

klzns added a commit to klzns/pt-BR.reactjs.org that referenced this pull request Feb 11, 2019
Following the changes made by the React team: reactjs/react.dev#863.
fjoshuajr pushed a commit to reactjs/pt-br.react.dev that referenced this pull request Feb 12, 2019
* Add function and class component to glossary

Following the changes made by the React team: reactjs/react.dev#863.

* Sort glossary
hyochan pushed a commit to hyochan/dooboo-ui that referenced this pull request Aug 2, 2021
* Fix inappropriate word in docs

   - Because 'functional component' is not an appropriate word, it was replaced by 'function component' in the official document in 2018.

   - See reactjs/react.dev#863 for datails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants