Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

segmentio/deku-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deku-loader

Circle CI

Show a loading indicator while you're loading things.

Example

import Loader from '@segment/deku-loader'

const App = {
  initialState() {
    return { data: null }
  },

  render({ state }) {
    return (
      <div class="App">
        <h1>loader</h1>
        <Loader isLoading={state.data}>
          <p>{state.data}</p>
        </Loader>
      </div>
    )
  },

  afterMount(_, __, setState) {
    fetch('/api/data')
      .then(r => r.json())
      .then(data => setState({ data }))
  }
}