I\'ve been learning more about React.js function components and have started transitioning one of my React.js applications to use them instead of the standard react components.
You can use react-pure-lifecycle to add lifecycle functions to functional components.
Example:
import React, { Component } from 'react';
import lifecycle from 'react-pure-lifecycle';
const methods = {
componentDidMount(props) {
//ajax call here
}
};
const Channels = props => (
Hello
)
export default lifecycle(methods)(Channels);