react-lowdb

Save React state on LocalStorage using lowdb

Usage no npm install needed!

<script type="module">
  import reactLowdb from 'https://cdn.skypack.dev/react-lowdb';
</script>

README

react-lowdb

Save React state on LocalStorage using lowdb

Build Status dependencies Status devDependencies Status License: MIT

Demo

Check it out on CodeSandbox

Installation

npm install react-lowdb

Usage

import ComponentWithReactLowdb from 'react-lowdb'

class Demo extends ComponentWithReactLowdb {

  // All state changes from Demo will now be saved
  // via ComponentWithReactLowdb's componentDidUpdate.
  //
  // They are loaded back via ComponentWithReactLowdb's
  // componentDidMount.

}

Props

  • defaultDBFields (Optional) - default values of the DB
  • dbName (Optional) - specify the name of the node to save in LocalStorage. Defaults to [constructor.name]-react-lowdb

License

MIT © Paul Gadi