Socket
Socket
Sign inDemoInstall

@felte/extender-persist

Package Overview
Dependencies
1
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @felte/extender-persist

Use localStorage to persist your Felte forms


Version published
Weekly downloads
45
increased by25%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

@felte/extender-persist

Tests Bundle size NPM Version codecov

A package to persist your form's state in localStorage.

Installation

npm install --save @felte/extender-persist

# Or, if you use yarn

yarn add @felte/extender-persist

Usage

Extend Felte with the extender export, the extenders accepts an object with options. A unique ID is required to use it as the ID for the localStorage.

import { extender } from '@felte/validator-yup';

const { form } = createForm({
  // ...
  extend: extender({ id: 'uniqueId' }), // or `extend: [extender({ id: 'uniqueId' })],`
  // ...
});

Ignoring fields

You might not want to save certain fields such as passwords to local storage, for this you may add an extra property to the configuration of the extender with an array of paths to the data you want to ignore:

{
  extend: extender({ id: 'uniqueId', ignore: ['account.password'] }),
}

Or you may add the attribute data-felte-extender-persist-ignore to the input you don't want to persist.

Keywords

FAQs

Last updated on 29 Aug 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc