paged-questionnaire

1.0.1 • Public • Published

paged-questionnaire

Made with create-react-library

NPM JavaScript Style Guide

Install

npm install --save paged-questionnaire

Usage

import React, { Component } from 'react'

import { PagedQuestions } from 'paged-questionnaire'

const QuestionsValues = {...} //check QuestionsValues in ./Example

class Example extends Component {

  const [error, setError] = useState(null)

  const onComplete = (data) => {
    console.log(data)
    //submit to backend (or other process...)
    //after submission, show error by: setError("message")
    setError(null)
    //process results
    //show error setError('an error has occured')
  }

  const questionPageCompleted = (currentPage) => {
    console.log('Finished Question Page #' + currentPage)
  }

  render() {
    return (
      <PagedQuestions
        questions={QuestionsValues}
          onComplete={onComplete}
          onQuestionDone={questionPageCompleted}
          errorMsg={error}
          showProgressBar={true}
      />
    )
  }
}
Parameters
*  onComplete = callback when all forms/pages are completed
*  nextButtonIcon, nextButtonLabel
*  backButtonIcon, backButtonLabel,
*  busy - flag shows spinner/loading icon
*  showProgressBar - show progressbar at the top
*  onQuestionDone - callback every time the user clicks next and answers passed the validations

License

MIT © aman-digtl

Readme

Keywords

none

Package Sidebar

Install

npm i paged-questionnaire

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

106 kB

Total Files

9

Last publish

Collaborators

  • aman-digtl