0

I'm learning React and I got struggle using map function to present data from json file. It do show the loading data before the data load but after that nothing. Print the state.questions in line 6 and do show that there is something in it. my code

State

2 Answers 2

3

You need the return statement. Or remove the {}

state.questions.map(ques => {return (<p key={ques.id}>{ques.question}</p>) })
Sign up to request clarification or add additional context in comments.

Comments

0

What i can see in your console questions is list of dict inside state.questions.

{state.questions.questions.map(q => {return (<p key={q.id}>{.question}</p>) })

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.