Start a personal dev blog on your domain for free with Hashnode and grow your readership.
Get Started

Announcement about @laststance/use-app-state

republished original from


  • After renaming package, react-appstate is no maintaining anymore.
  • Please use @laststance/use-app-state instead.
  • 99% User already migrated to @laststance/use-app-state even though I want to arrive this information a few user who start from my old react-appstate post.

That's it! and about this React library

This is 808b ultra light weight package for useAppState hook.
Freely pass and receive values between separated components.



npm install @laststance/use-app-state
# or
yarn add @laststance/use-app-state

TypeScript Example

// index.tsx
import React, { ReactElement } from 'react'
import ReactDOM from 'react-dom'
import Provider, { useAppState } from '@laststance/use-app-state'

interface Food {
  id: string
  name: string

type FoodList = Food[]

interface AppState {
  FoodList: FoodList

let initialAppState: AppState = {
  foodList: []

const App = () => {
const [appState, setAppState] = useAppState<AppState>() // pass appState object type as a generics
const item1: Food = {id: 'j4i3t280u', name: 'Hamburger'}
const item2: Food = {id: 'f83ja0j2t', name: 'Fried chicken'}
setAppState({foodList: [item1, item2]})

const foodListView: ReactElement[] = Food) => <p key={}>{f}</p>)

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

    <Provider initialState={initialAppState}>

Edit @laststance/use-app-state Example


You can use it immediately without leaning if you have a common experience as a React developer.

I'm glad to hitting demand this post like who excited prototyping frequency and wanted **setState that regardless component boundary.

Thank you for reading the article, Follow Me! 🐦 and feel free to unsubscribe! 🤗

Start a personal dev blog on your domain for free and grow your readership.

3.4K+ developers have started their personal blogs on Hashnode in the last one month.

Write in Markdown · Publish articles on custom domain · Gain readership on day zero · Automatic GitHub backup and more

No Comments Yet