ghost-portal/packages/react-hooks/src/useNonEmptyString.ts
Jaco Greeff 64299ebd29
Dev bump (#4012)
* Bump API/Common (esnext exports)

* Bump deps

* Adjust

* Bumps

* Bumps

* repository

* Update dev

* Remove Rococo (for the time being)

* script extension
2020-11-11 15:28:52 +01:00

12 lines
367 B
TypeScript

// Copyright 2017-2020 @polkadot/react-hooks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { useFormField, FormField } from './useFormField';
export function useNonEmptyString (initialValue = ''): FormField<string> {
return useFormField(
initialValue,
(value?: string | null): boolean => (value && value.length > 0) || false
);
}