How to use arrow function in React stateless components?


Stateless components can be defined using the fat arrow syntax, which exclude the use of return keyword.

Example

import React, { Component } from 'react';
 
export default () =>
    <h1 className="bg-secondary text-white text-center p-2">
        Hello World
    </h1>
Most Helpful This Week