Function updateFormFloatValue

  • Convenience function to update a form value with a Float value. If the user input does not return a number with parseFloat, no state change occurs. Pass the Meiosis cell and the state property (such as 'pH') or path (such as ['water', 'pH']) into which to update the value. Returns a function that you can pass to a DOM handler, such as oninput (Mithril) or onInput (Preact, React). For example:

    // Using Mithil
    m('input[type=text]', { oninput: updateFormFloatValue(cell, 'pH') })

    // Using Preact/React
    <input type="text" onInput={updateFormFloatValue(cell, ['water', 'pH'])}/>

    Returns

    a function that accepts a DOM event and updates the value on the Meiosis state.

    Type Parameters

    • S

    Parameters

    • cell: MeiosisCell<S>

      the Meiosis cell.

    • path: string[] | Extract<keyof S, string>

      the property or path into which to update the value.

    Returns ((evt: any) => S)

      • (evt: any): S
      • Parameters

        • evt: any

        Returns S

Generated using TypeDoc