Why are no components extending React.component?
See original GitHub issueIs this for performance purposes? Why not use mapDispatchToProps
?
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Composition vs Inheritance - React
React has a powerful composition model, and we recommend using composition instead of inheritance to reuse code between components.
Read more >Why we do extends React.Component when creating the ...
3 Answers 3 · So, it means that the react has provided many ways to create and render the components, either creating component...
Read more >REACT – Simple Intro Component Not Rendering?
import mainIntro from './components' class App extends React.Component{ render(){ return( <mainIntro /> ); } } const mainNode = document.
Read more >One small change to your React components that lets you ...
If we want to extend a component's style, then we first must make sure that the component passes down the className prop to...
Read more >React Components - W3Schools
A class component must include the extends React.Component statement. This statement creates an inheritance to React.Component, and gives your component ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @adriaanbalt, as I said before, arrow functions aren’t the most performant solution but probaly the most readable when the components are simple (just render basic html structures). Your example isn’t wrong (my coments below).
In general, as arrow functions are just syntax sugars for React Component I use this version to develop simple components (no handlers, no logic) and I extend React.PureComponent (https://facebook.github.io/react/docs/react-api.html#react.purecomponent) to develop complex components (handlers, logic, control render lifecycles, etc…).
If you want to stick using the same syntax in the whole project I advise you to use the 2nd version.
came across this article… https://medium.com/dailyjs/react-is-slow-react-is-fast-optimizing-react-apps-in-practice-394176a11fba