Hello.
I am a novice React user, making a simple application interacting with Firebase.
Please tell me how to render the resulting list of values.

The data structure in firebase
words:
     -LcpMf0KkXte40IfKdwS
            key:"fffddvsdvdv"
     -LcpMpw2trADUe5oYbtd
            key:"qqqq"
      -LcpUHbMEZVlovefySVf
            key:"wqwqwq"


Get database query
const response=await axios.get(`API_KEY/words.json`)
     const words=Object.values ​​(response.data)
     this.setState({
        words
       })

1 Answers 1

I'm a beginner

Do you think this somehow justifies your unwillingness to read the documentation? No, go and read.
  • So I read, I make and my errors fly out.

    Here is the last option

    render() {
                const users=this.state.words.map(key=><li>{key}</li>)
            return(
              <div className="todo-item">
                    {users}
              </div>
            )


    and
    Objects error is not valid as a react child(found: object with keys {key}).
    – Raging WWE Apr 20 '19 at 13:34
  • Raging WWE,

    So I read, I do, and my errors go out

    And why did you not tell about this in the text of the question? - how they did, and what kind of mistakes.

    And, by the way, say, you have json there - why did the data not be shown in the form of json, but demonstrated some unintelligible bit? Like, you are clever men, and so you guess what I have and how?

    They saw the mistake - and then what? Tried to understand what was said there? Bad with English - well, use online translators.

    Apparently, you have there not an array of strings, but an array of objects containing a single property-string.
    Try this: this.state.words.map(n=><li>{n.key}</li>).
    – The66 Apr 20 '19 at 13:41
  • The66, Thanks a lot, works.
    With the following questions, be sure to consider your comments!
    – Raging WWE Apr 20 '19 at 14:02