I try to give data with param using Route and using param, get data from server and print it. but useEffect doesn't work
export default function Board({ match }) {
const [content, setContent] = useState([]);
useEffect(() => {
getOnePost(match.params.number).then((response) => {
setContent(response);
});
console.log(content);
}, []);
return (
<div>
<div>hi</div>
</div>
);
}
<PrivateRoute
path="/board/:number"
authenticated={this.state.authenticated}
component={Board}
/>