score:5

Accepted answer

the type needs to reactclass<any>

export default (keys: array<string>) =>
  (wrappedcomponent: reactclass<any>) => (props: object): react.element<*> => {
    if (hasnotyetloadedprops(keys, props)) {
      return (
        <div
          style={{
            textalign: 'center',
            display: 'flex',
            justifycontent: 'center',
            alignitems: 'center',
            height: '100%',
          }}
        >
          <div>loading</div>
        </div>
      )
    }
    return <wrappedcomponent {... props} />
  }

Related Query

More Query from same tag