Functions as Components in React
In this lesson, we study functional stateless components which are a shorter way to create components that don't require to use lifecycle methods and don't need to maintain state
Functional Stateless Components
React uses the best of different programming paradigms. That’s only possible because JavaScript is a many-sided programming language. On the object-oriented programming side, React’s class components are a great way of leveraging the abilities of JavaScript classes (inheritance for the React component API, class methods and class properties such as this.state). On the other side, there are lots of concepts from functional programming used in React (and its ecosystem) too. For instance, React’s functional stateless components are another way of defining components in React. The question which led us functional stateless components in React: What if components could be used like functions?
Get hands-on with 1400+ tech skills courses.