Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 897 Bytes

UnparsedErrorContainer.md

File metadata and controls

33 lines (23 loc) · 897 Bytes

UnparsedErrorContainer

Component for notify user about errors that cannot be applied to model.

UnparsedErrorContainer should be wrapped into Form

Public interface

Props

UnparsedErrorContainer contains <div /> . All props for <div /> are valid for UnparsedErrorContainer.

Own props:

  • children - should be a function that returns valid component. Required

If error not exist, UnparsedErrorContainer wouldn't render children

If Form prop handleUnparsedErrors is falsy, UnparsedErrorContainer wouldn't render children

Example

<Form 
    onSubmit={async (values) => await someRequest(values)}
    validator={new SchemaValidator(ExampleSchema)}
    errorParser={(error) => myCustomParser(error)}
    handleUnparsedErrors
>
    <UnparsedErrorContainer>
        {(error) => <p>{error.message}</p>}
    </UnparsedErrorContainer>
</Form>