Hi there, I have the following code:
`
.
.
.
const PAGE_DATA_URL = 'http://localhost:3000/dataAPI.html';
.
.
.
function App() {
const [post, setPost] = React.useState(null);
React.useEffect(() => {
axios.get(PAGE_DATA_URL).then((response) => {
setPost(response.data);
//pageData = response.data;
console.log(response.data);
});
}, [] );
return (
<ThemeProvider theme={theme}>
<div>
<Navbar expand="lg" fixed="top" bg="primary">
<Navbar.Brand href="#home">{post.name}</Navbar.Brand>
.
.
.
`
The response.data is logging, but I assume it hasn't loaded by the time Navbar is rendered. If that is the issue, how might I go about waiting for the response before rendering anything?
Cheers!
Top comments (0)