New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-instances

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-instances

The library that manages React components instances

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

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

Keywords

react

FAQs

Package last updated on 24 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts