Function updateFormIntValue

  • Convenience function to update a form value with an Integer value. If the user input does not return a number with parseInt, no state change occurs. Pass the Meiosis cell and the state property (such as 'counter') or path (such as ['book', 'counter']) 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: updateFormIntValue(cell, 'counter') })

    // Using Preact/React
    <input type="text" onInput={updateFormIntValue(cell, ['book', 'counter'])}/>

    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