Socket
Socket
Sign inDemoInstall

@trainline/react-skeletor

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trainline/react-skeletor

Make your application look nice when its loading!


Version published
Weekly downloads
622
increased by19.16%
Maintainers
2
Weekly downloads
 
Created
Source

React Skeletor

React-skeletor gif

Skeleton preview for React components

Display a skeleton preview of your application's content before the data get loaded

Documentation

Basic usage

  1. Install via npm
npm install react-skeletor
  1. Wrap your component (often a container) with the createSkeletonProvider high order component. This adds the pending status and style into the context.
// UserDetailPage.js

import { createSkeltonProvider } from 'react-skeletor';

const UserDetailPage = ({ user }) => (
  <div>
    ...
    <NameCard user={user} />
    ...
  </div>
)

export default createSkeltonProvider(
  // Dummy data with a similar shape to your component's data
  {
    firstName: '_____',
    lastName: '________'
  },
  // Predicate specifying whether or not your data is loaded
  ({ user }) => user === undefined
)(UserDetailPage);
  1. Use a skeleton element to magically style your component when data is pending with zero effort!
// NameCard.js

import { h1 as SkeletonH1, h2 as SkeletonH2 } from 'react-skeletor';

const NameCard = ({ firstName, lastName }) => (
  <div>
    <SkeletonH1 style={style}>{ firstName }</SkeletonH1>
    <SkeletonH2 style={style}>{ lastName }</SkeletonH2>
  </div>
)

export default NameCard;

Contribute

Before opening any Pull Request please post an issue explaining the problem so that the team can evaluate if the Pull Request is relevant.

Keywords

FAQs

Package last updated on 22 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc