mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 16:06:28 +08:00
perf(OTP): useState initializer function called only once (#52878)
Co-authored-by: thinkasany <480968828@qq.com>
This commit is contained in:
parent
9b854e43dc
commit
444f579eb1
@ -153,7 +153,7 @@ const OTP = React.forwardRef<OTPRef, OTPProps>((props, ref) => {
|
||||
const internalFormatter = (txt: string) => (formatter ? formatter(txt) : txt);
|
||||
|
||||
// ======================== Values ========================
|
||||
const [valueCells, setValueCells] = React.useState<string[]>(
|
||||
const [valueCells, setValueCells] = React.useState<string[]>(() =>
|
||||
strToArr(internalFormatter(defaultValue || '')),
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user