import { React, ReactWhisper } from '@oliveai/ldk';
import { StateMap } from '@oliveai/ldk/dist/whisper/types';
const ComponentDemo: React.FunctionComponent<Object> = (props) => {
const textInputId = 'someUniqueId';
const [validateButtonClicked, updateButtonClicked] = React.useState(false);
const [validationError, updateValidationError] = React.useState('');
const onValidate = (state: StateMap) => {
state.get(textInputId) !== 'valid' ? "Input should be 'valid'" : undefined,
<oh-whisper label="Simple Form" onClose={() => {}}>
validationError={validationError}
label={validateButtonClicked ? 'Validate Again' : 'Validate'}
onClick={(error, whisperProps) => {
updateButtonClicked(true);
onValidate(whisperProps.componentState);
ReactWhisper.renderNewWhisper(<ComponentDemo/>);