-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Conversation
Deploy preview for reactjs ready! Built with commit e825fe5 |
Deploy preview for reactjs ready! Built with commit c983324 |
"Function component" sounds wrong grammatically. What about "component function" (and "component class" when talking about something extending React.Component")? |
We do say “class component” so I don’t think it’s too different. Just a bit unusual. |
Like “strawberry ice-cream”. |
Ok, as long as you stick to the ice cream analogy 😉 |
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. |
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. |
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.) |
934fcd0
to
47b9e3d
Compare
(Chatted with @sebmarkbage and he's not opposed) |
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? |
Following the changes made by the React team: reactjs/react.dev#863.
* Add function and class component to glossary Following the changes made by the React team: reactjs/react.dev#863. * Sort glossary
* 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.
Related to discussion in https://mobile.twitter.com/getify/status/993127777057550336
Yay or nay?