react-simplikit 0.0.37 → 0.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,18 +8,16 @@ import { ChangeEventHandler } from 'react';
|
|
|
8
8
|
* @param {(value: string) => string} [transformValue=(v: string) => v] - A function to transform the input value.
|
|
9
9
|
* Defaults to an identity function that returns the input unchanged.
|
|
10
10
|
*
|
|
11
|
-
* @returns {[value: string, onChange:
|
|
11
|
+
* @returns {[value: string, onChange: ChangeEventHandler<HTMLInputElement>]} A tuple containing:
|
|
12
12
|
* - value `string` - The current state value;
|
|
13
|
-
* - onChange `
|
|
13
|
+
* - onChange `ChangeEventHandler<HTMLInputElement>` - A function to update the state;
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* function Example() {
|
|
17
|
-
* const [value,
|
|
18
|
-
* return <input type="text" value={value} onChange={
|
|
17
|
+
* const [value, onChange] = useInputState('');
|
|
18
|
+
* return <input type="text" value={value} onChange={onChange} />;
|
|
19
19
|
* }
|
|
20
20
|
*/
|
|
21
|
-
declare function useInputState(initialValue?: string, transformValue?: (value: string) => string): readonly [string, ChangeEventHandler<
|
|
22
|
-
value: string;
|
|
23
|
-
}>];
|
|
21
|
+
declare function useInputState(initialValue?: string, transformValue?: (value: string) => string): readonly [string, ChangeEventHandler<HTMLInputElement>];
|
|
24
22
|
|
|
25
23
|
export { useInputState };
|
|
@@ -8,18 +8,16 @@ import { ChangeEventHandler } from 'react';
|
|
|
8
8
|
* @param {(value: string) => string} [transformValue=(v: string) => v] - A function to transform the input value.
|
|
9
9
|
* Defaults to an identity function that returns the input unchanged.
|
|
10
10
|
*
|
|
11
|
-
* @returns {[value: string, onChange:
|
|
11
|
+
* @returns {[value: string, onChange: ChangeEventHandler<HTMLInputElement>]} A tuple containing:
|
|
12
12
|
* - value `string` - The current state value;
|
|
13
|
-
* - onChange `
|
|
13
|
+
* - onChange `ChangeEventHandler<HTMLInputElement>` - A function to update the state;
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* function Example() {
|
|
17
|
-
* const [value,
|
|
18
|
-
* return <input type="text" value={value} onChange={
|
|
17
|
+
* const [value, onChange] = useInputState('');
|
|
18
|
+
* return <input type="text" value={value} onChange={onChange} />;
|
|
19
19
|
* }
|
|
20
20
|
*/
|
|
21
|
-
declare function useInputState(initialValue?: string, transformValue?: (value: string) => string): readonly [string, ChangeEventHandler<
|
|
22
|
-
value: string;
|
|
23
|
-
}>];
|
|
21
|
+
declare function useInputState(initialValue?: string, transformValue?: (value: string) => string): readonly [string, ChangeEventHandler<HTMLInputElement>];
|
|
24
22
|
|
|
25
23
|
export { useInputState };
|