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

@actorize/react

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@actorize/react

A React hook for @actorize/core

latest
Source
npmnpm
Version
1.0.0-alpha.1
Version published
Weekly downloads
37
2.78%
Maintainers
1
Weekly downloads
 
Created
Source

@actorize/react

gzip size

this is just the React Extension for @actorize/core

Getting Started

$ npm install @actorize/react
# or
$ yarn add @actorize/react
import { ActorizeProvider, useActorize } from '@actorize/react';
import {
  dispatch
} from '@actorize/core';
import director from './director';
// ...

const MyCoolActor = () => {
  const [state, setState] = useSate(0)

  const actor = useActorize('cool-actor', {
    onMessage: (msg) => {
      if (msg.payload === 'INC') {
        setState(state + 1)
      }
    },
  });

  return (
    <div>
      {state}
    </div>
  )
}

const ThatBigButton = () => {
  const handleClick = () => {
    dispatch(director, 'cool-actor', 'INC');
  }
  return (
    <button onClick={handleClick} >Click Me</button>
  )
}

const Wrapper = () => (
  <ActorizeProvider director={director}>
    <MyCoolActor />
    <ThatBigButton />
  </ActorizeProvider>
)

Keywords

actor

FAQs

Package last updated on 05 Sep 2022

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