import React, { useState, useEffect, useRef } from 'react'; import MainNav from '../Components/MainNav'; import SubNav from '../Components/SubNav'; import { Row, Col, Button, Form, Container } from 'react-bootstrap'; import axios from 'axios' function ProductsRegist() { const [product, setProduct] = useState() function handleChange(event) { const { name, value } = event.target console.log("file=",event.target.files) console.log("name=",name,"value=",value) setProduct({ ...product, [name]: value }) } function handleSubmit(e) { e.preventDefault() const formData = new FormData(); for (let key of Object.keys(product)) { formData.append(key, product[key]) } console.log("formData=",formData) axios.post('/api/product/regist',{data: formData}).then(function(res) { console.log("client의 res=", res) }) } return (