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

recoil-logger

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

recoil-logger

Logger for recoil state manager

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
36
decreased by-2.7%
Maintainers
1
Weekly downloads
 
Created
Source

Recoil-logger

Logger for state manager recoil.

Demo

Example of logs in browser's conosle

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import { RecoilRoot } from "recoil";
import RecoilLogger from 'recoil-logger'

ReactDOM.render(
  <React.StrictMode>
    <RecoilRoot>
      <RecoilLogger />
      <App />
    </RecoilRoot>
  </React.StrictMode>,
  document.getElementById('root')
);

Install

npm install --save-dev recoil-logger

or

yarn add --dev recoil-logger

Now you could add RecoilLogger to your app:

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import { RecoilRoot } from "recoil";
import RecoilLogger from 'recoil-logger'

ReactDOM.render(
  <React.StrictMode>
    <RecoilRoot>
+      <RecoilLogger /> {/* Please add this line inside `RecoilRoot` scope */}
      <App />
    </RecoilRoot>
  </React.StrictMode>,
  document.getElementById('root')
);

After this you can see the events on each atom in browser's console:

Example of logs in browser's conosle

But to see the values you need to add persistence_UNSTABLE key to atom properties:

const counterState = atom({
  key: "count",
  default: 0,
+  persistence_UNSTABLE: {
+    type: 'log'
+  },
});

The key type can has any value but not none (by default it is none).

Example of logs in browser's conosle

Notes

This package use unstable hook useTransactionObservation_UNSTABLE. As far it will be stable the package will be updated with new API.

Demo

$ git clone git@github.com:polemius/recoil-logger.git
$ cd recoil-logger
$ npm install
$ npm run start

Please open localhost:1234

Keywords

FAQs

Package last updated on 23 Jan 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

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