Skip to content

Connector API to access isPending #11

@SamyPesse

Description

@SamyPesse

I'm starting to use react-skeletor, and I'm missing something in the API: a connector to access the isPending and have my own logic of rendering, for example a component to render an avatar:

import { connectSkeleton } from '@trainline/react-skeletor';

@connectSkeleton(({ isPending }) => ({
    isPending
})
class Avatar extends React.Component {
    render() {
         const { isPending } = this.props;

         return isPending ? <div></div> : <a href="...">...</a>
    }
}

Currently, I can directly use contextTypes and get the skeleton context, but this is a not recommended API by React.

At some point, it may requires a subscribing schema in the context instead of storing the values directly.

Will you be willing to accept a connectSkeleton API ? (I can make a PR)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions