npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-orbitjs

v0.3.5

Published

React.js bindings for Orbit.js

Downloads

38

Readme

react-orbitjs

npm ci Codecov Code Climate

React bindings for Orbit.

This package attempts to make it easier to work with Orbit.js in a React environment. In a nutshell it's a transform listener, updating a component props with records as they are changed. If you're familiar with redux in combination with react-redux, you already know how to use this package.


Documentation & Demo


A big thank you to the author and contributers of the popular react-redux package, as react-orbitjs is largely based on their code.

Installation

react-orbitjs requires Orbit 0.16.x or 0.17.x.

npm

npm install --save react-orbitjs

yarn

yarn add react-orbitjs

API

<DataProvider/>

const store = new MemorySource({schema})

// Simply pass a reference to your Orbit store to the <DataProvider/> component
// and wrap your root App component. The provider makes a dataStore child
// context available to all children, which is consumed by the HOC generated
// with the withData() connector.
ReactDOM.render(
  <DataProvider dataStore={store}>
    <App/>
  </DataProvider>,
  rootElement
)

withData()

// This mapper uses the props passed in to manipulate the queries. Useful for
// sort/filter functions, etc.
const mapRecordsToProps = (ownProps) => {
  return {
    planets: q => q.findRecords("planet").sort(ownProps.sortBy),
  }
}

// Or use a simple object if you don't use the props in your queries.
const mapRecordsToProps = {
  planets: q => q.findRecords("planet"),
}

// Export the generated component. Your <Planetarium/> component receives all
// the props you pass to the wrapper component, combined with the results from
// the queries defined in the mapRecordsToProps function or object, and
// convenience queryStore and updateStore props, which defer to store.query and
// store.update.
export default PlanetariumWithData = withData(mapRecordsToProps)(Planetarium)

License

MIT