mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 05:10:19 +08:00
fix: fix bug about updating parent component value in CountryCodeSelect (#1891)
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user