Socket
Socket
Sign inDemoInstall

@comparaonline/ui-form-errors

Package Overview
Dependencies
Maintainers
14
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@comparaonline/ui-form-errors

## Installation


Version published
Weekly downloads
159
decreased by-14.97%
Maintainers
14
Weekly downloads
 
Created
Source

@comparaonline/ui-form-errors

Installation

yarn add @comparaonline/ui-form-errors

Usage

This package exposes a ErrorMessages context using ErrorMessageProvider and ErrorMessagesConsumer. A utility called replacer can be used to use templates that follow this convention

'The min value is {{minValue}} and the maxValue is {{maxValue}}'

... in your ErrorMessagesConsumer.

ErrorMessagesProvider

import { ErrorMessagesProvider } from '@comparaonline/ui-form-errors';

interface ErrorMessages = {
  [errorCode: string]: string
}

const errorMessages: ErrorMessages = {
  required: 'This field is required',
  outOfRange: 'The min value is {{minValue}} and the maxValue is {{maxValue}}'
}

<ErrorMessagesProvider value={{ errorMessages }}>
  ...
</ErrorMessagesProvider>

ErrorMessagesConsumer

<ErrorMessagesConsumer>
  {({ errorMessages }) => ()}
</ErrorMessagesConsumer>

FAQs

Package last updated on 01 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc