0.0.7 • Published 4 years ago

json-parse-to-form v0.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Json-Parse-To-Form

Parse a JSON to a dynamic form, allowing to change values on JSON

How to user

Instalation

First install the dependency:

$ npm install json-parse-to-form

Them import the dependency in your project

import JsonToForm from 'json-parse-to-form'

Usage

function App() {
  const [data, setData] = useState({ name: "John", surname: "Doe", age: "25"})
  return (
    <FormToJson 
      json={data} 
      setJson={setData} 
      ignoredFields={[age]}
    />)
}

WIP

factory

Routine to permit insert a new object on array

Example:

const factoryObjects = {
  docs: {
    type: '', number: '', 
  }
}

function App() {
    const [data, setData] = useState({ name: "John", surname: "Doe", age: "25", docs: []})

    const getFactory(valueType) => {
      return factoryObjects[valueType]
    }

    return (
      <FormToJson 
        json={data} 
        setJson={setData} 
        ignoredFields={[age]}
        factory={getFactory}
      />)
}
0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.1

4 years ago