Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@comparaonline/ui-form-errors

Package Overview
Dependencies
Maintainers
16
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

  • 0.7.14-alpha.1
  • npm
  • Socket score

Version published
Maintainers
16
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 17 Jun 2019

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