Skip to content

Commit 28dcdb9

Browse files
EmilyyyLiu刘欢
andauthored
refactor: Upgrade utils and replace useMergedState (#136)
Co-authored-by: 刘欢 <lh01217311@antgroup.com>
1 parent a9651cf commit 28dcdb9

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
},
4646
"dependencies": {
4747
"classnames": "^2.2.1",
48-
"@rc-component/util": "^1.2.0"
48+
"@rc-component/util": "^1.3.0"
4949
},
5050
"devDependencies": {
5151
"@rc-component/father-plugin": "^2.0.3",

src/Input.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import clsx from 'classnames';
2-
import useMergedState from '@rc-component/util/lib/hooks/useMergedState';
2+
import useControlledState from '@rc-component/util/lib/hooks/useControlledState';
33
import omit from '@rc-component/util/lib/omit';
44
import React, {
55
forwardRef,
@@ -55,9 +55,7 @@ const Input = forwardRef<InputRef, InputProps>((props, ref) => {
5555
};
5656

5757
// ====================== Value =======================
58-
const [value, setValue] = useMergedState(props.defaultValue, {
59-
value: props.value,
60-
});
58+
const [value, setValue] = useControlledState(props.defaultValue, props.value);
6159
const formatValue =
6260
value === undefined || value === null ? '' : String(value);
6361

0 commit comments

Comments
 (0)