Skip to content

Commit 509867e

Browse files
committed
move react-intl helpers to separate entrypoint
1 parent dee5853 commit 509867e

5 files changed

Lines changed: 5 additions & 8 deletions

File tree

readme.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,22 @@ import { IntlProvider } from 'react-intl'
3030

3131
```
3232

33-
Finally, configure `Zod` to use the new translations. You can use these helpers with `React`:
33+
Finally, configure `Zod` to use the new translations. The following helpers can be used with `React`. They require the `react-intl` package to be installed.
3434

3535
```js
36-
import { useZodInternationalizationWithReactIntl } from '@aboutbits/zod-locales-formatjs'
36+
import { useZodInternationalizationWithReactIntl } from '@aboutbits/zod-locales-formatjs/react-intl'
3737

3838
useZodInternationalizationWithReactIntl()
3939
```
4040

4141
or
4242

4343
```js
44-
import { ZodInternationalizationWithReactIntl } from '@aboutbits/zod-locales-formatjs'
44+
import { ZodInternationalizationWithReactIntl } from '@aboutbits/zod-locales-formatjs/react-intl'
4545

4646
<ZodInternationalizationWithReactIntl />
4747
```
4848

49-
These `React` helpers require to install the `react-intl` package.
50-
5149
If you don't use `React`, you can set the `ZodErrorMap` manually with:
5250

5351
```js

src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ export * from './zod/errorMessages'
33

44
export { default as de } from './translations/de.json'
55
export { default as it } from './translations/it.json'
6-
7-
export * from './react/useZodInternationalizationWithReactIntl'
8-
export * from './react/ZodInternationalizationWithReactIntl'

src/react-intl.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './react-intl/useZodInternationalizationWithReactIntl'
2+
export * from './react-intl/ZodInternationalizationWithReactIntl'
File renamed without changes.

src/react/useZodInternationalizationWithReactIntl.ts renamed to src/react-intl/useZodInternationalizationWithReactIntl.ts

File renamed without changes.

0 commit comments

Comments
 (0)