useEffect(() => {
id ? fetch(`${url}/selectCompany`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
id: id
})
})
.then(response => response.json())
.then(result => {
console.log(result)
setCompany(result)
}) : false;
}, [id, setCompany]);
console.log(company); // === null
const {topic,body,author} = req.body;
mysql.query('insert into users set ?', {topic, body, author}, (res, err) => {})