mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 18:54:03 +08:00
fix: fix bug about updating parent component value in CountryCodeSelect (#1891)
This commit is contained in:
parent
d29fc88d68
commit
80e6e7f0a7
@ -19,7 +19,12 @@ import React from "react";
|
||||
export const CountryCodeSelect = (props) => {
|
||||
const {onChange, style, disabled} = props;
|
||||
const countryCodes = props.countryCodes ?? [];
|
||||
const [value, setValue] = React.useState(countryCodes.length > 0 ? countryCodes[0] : "");
|
||||
const [value, setValue] = React.useState("");
|
||||
|
||||
React.useEffect(() => {
|
||||
const initValue = countryCodes.length > 0 ? countryCodes[0] : "";
|
||||
handleOnChange(initValue);
|
||||
}, []);
|
||||
|
||||
const handleOnChange = (value) => {
|
||||
setValue(value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user