npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-formdata-wizard

v0.0.14

Published

A wizard library focusing on keeping entered form data even across reloads

Downloads

131

Readme

UclusionWizard

react-formdata-wizard

React wizard that maintains step state and form data for you. Form data is automagically saved to the local storage of the browser, so you don't have to worry about reloads or any other ram-state destroying event.

NPM JavaScript Style Guide

Install

npm install --save react-formdata-wizard

Usage

import React, { Component } from 'react'

import FormdataWizard from 'react-formdata-wizard'
import 'react-formdata-wizard/dist/index.css'

class Example extends Component {
  render() {
    return (
      <FormdataWizard>
        <Step0/>
        <Step1/>
        ...
      </FormdataWizard>
  )
  }
}

General Ethos

This package does NOT render any UI by itself. It doesn't have any buttons, nor does it specify fancy transitions. What it will do is maintain the current step progress and any form data you give to it. The form data passed in is persisted into the browsers local storage until the form is either started over or reset.

Child internal state

The actual step rendered is a clone of the child representing the current step. For this reason children cannot maintain their own state, and should use the form data instead of useState or useReducer

Props accepted by the Wizard

Property Name | Property Description | Required --- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------| --- name | the 'name' of the wizard. Should be unique as it will determine the local storage key used | Y onStartOver | function called with zero arguments that is called when the form is started over without completing | N onFinish | function called with either the form data or a specific return value that is called when the form finishes normally | N resetSetter | function that will be called with a variable containing a function that can reset the wizard. This allows higher level components to cause a reset for their own reasons. | N defaultFormData | default form data to apply on creation if nothing is stored locally. | N useLocalStorage | whether to back the wizard with local storage or not | Y startStep | the step to start the wizard from. Used if some steps are no longer needed | N

Props provided to All Children

Property Name | Property Description --- | --- currentStep | the 0-indexed step number we're on totalSteps | the number of steps we have formData | the current form data accumulated so far updateFormData | function that takes an update object and merges the existing formdata with the update object clearFormData | function that resets the form data to the empty object nextStep | function that advances the wizard by increment steps where increment defaults to one previousStep | function that regresses teh wizzard to the previous step startOver | function that calls onStartOver and then resets the wizard to the initial state active | boolean that tells the step if it is the currently active step finish | function taking one optional argument that calls the provided onFinish with that argument, or if not provided the current form state, then resets the wizard to the initial state

License

GPLv3 © Uclusion Inc, 2020 BFUculsion