React-Redux - Hooks API
Hooks are not compatible with Class components. To use Hooks, you convert the class components to function components. For instance, your code can be refactored to
/**
* Messages List
*/
const getActiveUser = (state: State) => state.activeUser;
const getMessagesList = (state : State) => (Object.keys(state.messages).map((key : any)=> state.messages[key]));
const MessagesList: React.FC = () => {
const activeUser = useSelector(getActiveUser);
const messagesList = useSelector(getMessagesList);
....
}
export default MessagesList;