November 2018
Beginner
502 pages
10h 22m
English
We're going to create a loader spinner component called withLoader that can be used with any component to indicate that the component is busy doing something:
import * as React from "react";interface IProps { loading: boolean;}const withLoader = <P extends object>( Component: React.ComponentType<P>): React.SFC<P & IProps> => ({ loading, ...props }: IProps) => // TODO - return a loading spinner if loading is true otherwise return the component passed in export default withLoader;
There are a few things going on here, so let's break this down:
Read now
Unlock full access