1 | import * as React from 'react';
|
2 | import { UIDProps } from './context';
|
3 | interface WithPrefix {
|
4 | prefix?: string;
|
5 | }
|
6 | /**
|
7 | * UID isolation component, required for SSR and testing.
|
8 | * Wrap your application with it to guarantee UID consistency between SSR and CSR.
|
9 | * @param {String} [prefix] - prefix for all generated ids
|
10 | * @example
|
11 | * <UIDReset>
|
12 | * <App />
|
13 | * </UIDReset/>
|
14 | * @see https://github.com/thearnica/react-uid#server-side-friendly-uid
|
15 | */
|
16 | export declare const UIDReset: React.FC<React.PropsWithChildren<WithPrefix>>;
|
17 | /**
|
18 | * Creates a sub-ids for nested components, isolating from inside a branch.
|
19 | * Useful for self-contained elements or code splitting
|
20 | * @see https://github.com/thearnica/react-uid#code-splitting
|
21 | */
|
22 | export declare const UIDFork: React.FC<React.PropsWithChildren<WithPrefix>>;
|
23 | /**
|
24 | * UID in form of renderProps. Supports nesting and SSR. Prefer {@link useUID} hook version if possible.
|
25 | * @see https://github.com/thearnica/react-uid#server-side-friendly-uid
|
26 | * @see https://github.com/thearnica/react-uid#react-components
|
27 | * @example
|
28 | * // get UID to connect label to input
|
29 | * <UIDConsumer>
|
30 | * {(id)} => <label htmlFor={id}><input id={id}/>}
|
31 | * </UIDConsumer>
|
32 | *
|
33 | * // get uid to generate uid for a keys in a list
|
34 | * <UIDConsumer>
|
35 | * {(, uid)} => items.map(item => <li key={uid(item) />)}
|
36 | * </UIDConsumer>
|
37 | *
|
38 | * @see {@link useUID} - a hook version of this component
|
39 | * @see {@link UID} - not SSR compatible version
|
40 | */
|
41 | export declare const UIDConsumer: React.FC<UIDProps>;
|
42 | export {};
|