You’ve specified that your render function isn’t rendering anything except the div and the title: it’s a function, but you aren’t returning anything except
<div>
<h5>The Disruptions</h5>
</div>
You map over the state, but you don’t do anything with that. I assume you meant to write something like
Thanks again for the help, I see what your saying now, I’ve done this before but my mind has gone blank! So I’ve used what you said and this is my code now:
Yes, sorry @john1! I just cut and pasted on my phone without checking if it was completely correct. Look at the parentheses, they need to match: you have an opening one for map but no closing one, that’s why the curly bracket at the end is highlighted red
One thing i’d like to give you advice if you are not confortable with braces yet is keep everything equal
If you type { just close it imidiately with }, then get back inside the brackets, then continue with your code, so you dont mess up the pattern. But i believe vscode has the autoclose brackets tho
So am I connecting properly to the API as in calling the right title / mode etc.
I am calling the following:
{disruption.title}
In the .map is this correct.
Also want to say a massive thank you for all the help I get in this forum, I lover FCC been here for about 4 years, plodding along and I love seeing this community grow - so many thanks!
seems like you had a “classic” react issue when the fetching not finished yet, but the component got rendered which gonna have a empty disruptions state.
just imagine that the componentDidMount and render function running at the same time. So you need to handle the data when its not fetched yet (by printing loading..). Not the best practice tho checking the fetch status by using disruptions length. But it gets the job done