@entropik/decode-survey-packages
TypeScript icon, indicating that this package has built-in type declarations

1.0.1002 • Public • Published

decode-survey-packages

Dynamic decode survey packages

NPM JavaScript Style Guide

Install

npm install --save decode-survey-packages

How to setup

use node version 14.15.1

- create file .env at root level with following content `SKIP_PREFLIGHT_CHECK=true`
- npm install
- npm start
- cd /example
- create file .env at with following content `SKIP_PREFLIGHT_CHECK=true`
- npm install
- npm start

Do's and Dont's

  • Don't introduce state in render components i.e. components starting with Render. Render components are abstracted out strictly for render logic.
  • Don't add useEffect in render components either for the reasons mention above.
  • Create a top level component for each question type.
  • The top level component should be used for one question type only. This top level component will be imported by user to add a question type. For example, a component called Type1Question should be exported for QuestionType1 only. For QuestionTypes2, QuestionType3, create component Type2Question, Type3Question and so on. Introduce layers of components at lower level to handle the common logic.
  • Keep the state at a high level component (at single place for a question type) instead of breaking it down to smaller component. We may need it to create payload and pass it to getJsonData()
  • Use consistent naming pattern for components and filenames.
  • If there is stateful logic common accross multiple question types extract it out in a custom hook.
  • Your code is your first level of documentation, add appropriate variable name and function names. Add comments wherever required.
  • Define appropriate interfaces and types whereever required, don't abuse any.
  • Use BEM for classnames
  • Keep the code clean.
    • Don't leave commented code.
    • Fix errors and warnings before merging it to master.

Usage

check /example 
for the usage of each question types

License

MIT © ajit-kumar-Converz

Readme

Keywords

none

Package Sidebar

Install

npm i @entropik/decode-survey-packages

Weekly Downloads

726

Version

1.0.1002

License

MIT

Unpacked Size

3.13 MB

Total Files

83

Last publish

Collaborators

  • tech-entropik