diff --git a/egovframe-template-simple-react-contribution/src/components/commonCode/CheckBox.jsx b/egovframe-template-simple-react-contribution/src/components/commonCode/CheckBox.jsx new file mode 100644 index 0000000..10c0822 --- /dev/null +++ b/egovframe-template-simple-react-contribution/src/components/commonCode/CheckBox.jsx @@ -0,0 +1,61 @@ +import React, {useCallback, useEffect, useState} from "react"; +import Form from "react-bootstrap/Form"; +import * as EgovNet from "api/egovFetch"; + +function CheckBox({name, grpCd, selectedValue}){ + + const [checkBox, setCheckBox] = useState(); + + useEffect(() => { + getCodeItemList() + }, []); + useEffect(() => { + setCheckedValue(selectedValue) + }, [checkBox]); + + function getCodeItemList() { + EgovNet.requestFetch( + '/commonCode/code-item?grpCd='+grpCd, + { + method: "GET" + }, + (resp) => { + let checkBoxTag = []; + resp.result.codeList.forEach(function (item, index) { + checkBoxTag.push( +