An open API service indexing awesome lists of open source software.

https://github.com/ben-rogerson/react-signals-introduction

A small introduction to signals and how they may be used in React 🀘
https://github.com/ben-rogerson/react-signals-introduction

Last synced: 3 months ago
JSON representation

A small introduction to signals and how they may be used in React 🀘

Awesome Lists containing this project

README

          

# React signals introduction

This repo is a quick introduction to signals using [signal-polyfill](https://www.npmjs.com/package/signal-polyfill) - a polyfill for the `Signal` API.

The [TC39 signals proposal](https://github.com/tc39/proposal-signals) is still being worked on and so things may change - but we can still see how things may end up looking.

So far it’s looking good and is fairly easy to work with - I only wish there would be method exposed to reset signal state back to the initial value.
This polyfill only exposes a `.get()` and `.set()` method but you can pass the initial value (eg: `counterState.set(INITIAL_VALUE)`) which does the same thing.

[πŸ‘‰ Check the demo](https://react-signals-introduction.vercel.app/)