formhero/test/blocks.tsx

12 lines
634 B
TypeScript
Raw Normal View History

2023-03-03 22:08:54 +00:00
import React from 'react'
// Custom field with non standard setter and getter. Emulate custom component from a library
export function NumberField(props: { number: number; update: (value: number) => void }) {
return <input data-testid="field" value={props.number} onChange={(e) => props.update(parseInt(e.target.value))} />
}
// Component that needs a different extractor, as it's returning the actual value and not the event.
export function DirectReturnInput(props: { value: string; onChange: (v: string) => void }) {
return <input data-testid="field" value={props.value} onChange={(e) => props.onChange(e.target.value)} />
}