| Start |
|---|
| Stateless Functional Component Components let you split the UI into independent, reusable pieces. This is the beauty of React; we can separate a page into many small reusable components. Prior to React v14 we could create a stateful React component using React v14 introduced a simpler way to define components, usually referred to as stateless functional components. These components use plain JavaScript functions. For example: This function is a valid React component because it accepts a single Stateless functional components typically focus on UI; state should be managed by higher-level “container” components, or via Flux/Redux etc. Stateless functional components don’t support state or lifecycle methods. Benefits:
Summary: If you are writing a React component that doesn't require state and would like to create a reusable UI, instead of creating a standard React Component you can write it as a stateless functional component. Let's take a simple example : Let's say we have a page that can register a user, search for registered users, or display a list of all the registered users. This is entry point of the application, The
Finally, our stateless functional component
Reference: https://facebook.github.io/react/docs/components-and-props.html (opens new window) RemarksStateless functional components in React are pure functions of the passed in See https://facebook.github.io/react/docs/reusable-components.html#stateless-functions (opens new window) for further information about stateless functional components. |
Read Article
https://develop.horje.com/learn/1434/reference