Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-stateful-function

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

react-stateful-function - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

example.tsx

16

index.ts

@@ -1,14 +0,2 @@

import { useEffect, useReducer } from 'react';
const mini_reducer = (state = {}, action) => ({ ...state, [action.type]: action.payload });
const constructState = (initialState: object = {}) => {
const [state, dispatch] = useReducer(mini_reducer, initialState);
const setState = (fState = {}) => { for (const type in fState) {dispatch({ type, payload: fState[type] });} };
const resetState = () => setState(initialState);
return { state, setState, resetState };
};
const funcDidMount = (doAfterMount: Function) => useEffect(() => { doAfterMount(); }, [doAfterMount]);
const funcWillUnmount = (doBeforeUnmount: Function) => useEffect( () => { return () => doBeforeUnmount(); }, [doBeforeUnmount]);
const funcDidUpdate = (values: Array<string>, doOnChange: Function) => useEffect(() => { doOnChange(); }, [values]);
export { constructState, funcDidMount, funcWillUnmount, funcDidUpdate };
export * from "./example";
export * from "./src";
{
"name": "react-stateful-function",
"version": "0.0.1",
"version": "0.0.2",
"description": "React Statful Function",

@@ -5,0 +5,0 @@ "main": "index.ts",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc