Small, smart and elegant modules for React
JavaScript
Latest commit fbc1826 May 3, 2018
Permalink
Failed to load latest commit information.
src Fixes #40 May 4, 2018
.gitignore Update .gitignore Apr 11, 2016
.npmignore Add empty npmignore Apr 12, 2016
.prettierrc Fixes #40 May 4, 2018
LICENSE.md Initial commit Apr 5, 2016
README.md Fixes #40 May 4, 2018
package-lock.json 0.36.0 Aug 16, 2017
package.json 0.36.1 May 4, 2018

README.md

Smalldots

Small, smart and elegant modules for React

npm

Documentation

  • Recipes are available on the Smalldots Wiki
  • Guides and API reference are not finished yet

Sample usage:

Fetch

* Check Customizing Fetch for details on how to set the base URL and configure authorization.

const IPAddressWidget = () => (
  <Fetch url="https://api.ipify.org?format=json" lazy={true}>
    {({ fetching, data, error, fetch }) => {
      if (fetching) {
        return <i className="fa fa-spinner fa-spin" />
      }
      if (data) {
        return <p className="text-success">Your IP Address is {data.ip}</p>
      }
      if (error) {
        return <p className="text-danger">Something bad happened</p>
      }
      return (
        <button className="btn btn-link" type="button" onClick={() => fetch()}>
          What is my IP Address?
        </button>
      )
    }}
  </Fetch>
)