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-instances

v0.1.2

Published

The library that manages React components instances

Downloads

29

Readme

react-instances

The library that manages React Component instances

This library is under construction and not stable right now. It is planned to release the first stable version on May 17, 2021 (or maybe sooner).

NPM JavaScript Style Guide

Install

npm install --save react-instances

Introduce

// anywhere in your awesome application
import Input from './Input'

const myInput = Input.getInstance('myInput')
myInput.setState({ value: 'test' })
myInput.upperCase()
myInput.clear()
// App.js
import Input from './Input'

export default function App() {
  return <Input name='myInput' />
}
// Input.js
import { withInstanceManage } from 'react-instances'

class Input extends Component {
  state = { value: '' }

  upperCase = () => {
    this.setState({ value: this.state.value.toUpperCase() })
  }

  clear = () => {
    this.setState({ value: '' })
  }
}

export default withInstanceManage(Input)

Demo & Documents

API

Communication

Discussion

Discord

Contact point

Decisions tree

react-instance-decisions-tree

What do you need?

I want to interactive with

  • My class component

    • withInstanceManage Open in CodeSandbox
  • My function component

    • manageInstances & useInstanceManage Open in CodeSandbox
  • My hook

    • withHookInstanceManage Open in CodeSandbox
    • manageInstances & useInstanceManage Open in CodeSandbox

I want to watch the changes of

  • My class component

    • Not supported yet
  • My function component

    • observable & useObserversNotify Open in CodeSandbox
  • My hook

    • withHookObserversNotify Open in CodeSandbox
    • observable & useObserversNotify Open in CodeSandbox

I want to do both with

  • My class component

    • Not supported yet
  • My function component

    • manageInstances & useInstancemanage & observable & useObserversNotify Open in CodeSandbox
  • My hook

    • withHookManage Open in CodeSandbox
    • manageInstances & useInstancemanage & observable & useObserversNotify Open in CodeSandbox

License

MIT © unique01082