0.1.3 • Published 6 years ago

data-promiser v0.1.3

Weekly downloads
10
License
-
Repository
-
Last release
6 years ago

Data promiser

React component to render data from promises

Usage

Install using yarn

yarn add data-promiser

or with npm

npm install --save data-promiser

Example

import React from 'react'
import DataPromiser from 'data-promiser'

function examplePromiseFn() {
  return new Promise((resolve, reject) => {
    window.setTimeout(() => {
      resolve('SUCCESS')
    }, 2000)
  })
}

const ExampleComponent = () => (
  <div>
    <section>
      <p>Wait 2 seconds before resolving. </p>

      <DataPromiser
        promiseFn={examplePromiseFn}
        renderData={(data, waiting) => (
          <p>{data}</p>
        )}
      />
    </section>
  </div>
)
0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago