Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用ReactJs查找部门计数。我使用JavaSpring引导和PostgreSql中使用的数据库制作了后端 import React,{useffect,useState}来自“React” 从“axios”导入axios 函数GetAllDepar_Javascript_Html_Reactjs_Spring Boot_Web Frontend - Fatal编程技术网

Javascript 如何使用ReactJs查找部门计数。我使用JavaSpring引导和PostgreSql中使用的数据库制作了后端 import React,{useffect,useState}来自“React” 从“axios”导入axios 函数GetAllDepar

Javascript 如何使用ReactJs查找部门计数。我使用JavaSpring引导和PostgreSql中使用的数据库制作了后端 import React,{useffect,useState}来自“React” 从“axios”导入axios 函数GetAllDepar,javascript,html,reactjs,spring-boot,web-frontend,Javascript,Html,Reactjs,Spring Boot,Web Frontend,如何使用ReactJs查找部门计数。我使用JavaSpring引导和PostgreSql中使用的数据库制作了后端 import React,{useffect,useState}来自“React” 从“axios”导入axios 函数GetAllDepartmentCount(){ 让[department,setDepartment]=useState([]) 函数handleSubmit(事件){ event.preventDefault() 控制台日志(“提交”); sendToBacke

如何使用ReactJs查找部门计数。我使用JavaSpring引导和PostgreSql中使用的数据库制作了后端
import React,{useffect,useState}来自“React”
从“axios”导入axios
函数GetAllDepartmentCount(){
让[department,setDepartment]=useState([])
函数handleSubmit(事件){
event.preventDefault()
控制台日志(“提交”);
sendToBackend()
}
让sendToBackend=()=>{
axios
.post(“http://localhost:9000/ems/department/addDepartment/“,部门)
.然后((res)=>console.log(res.data))
.catch((错误)=>console.log(错误));
};
返回(
部门计数


) } 导出默认GetAllDepartmentCount
import React ,{useEffect,useState} from 'react'
import axios from 'axios'

function GetAllDepartmentCount() {
    let [department,setDepartment]=useState([])
    
    function handleSubmit(event) {
        event.preventDefault()
        console.log("submit");
        sendToBackend()
      }

      let sendToBackend = () => {
        axios
          .post("http://localhost:9000/ems/department/addDepartment/", department)
          .then((res) => console.log(res.data))
          .catch((error) => console.log(error));
      };



    return (
        <div>
            <h4>Department Count</h4>
            <hr/>
            
            <hr/>
        </div>
    )
}

export default GetAllDepartmentCount