A
A
Alex Polyakh2017-08-30 17:55:51
JavaScript
Alex Polyakh, 2017-08-30 17:55:51

Pass the dom function to the element that I created with creating React.js elements with JSX. DOM. name (input,li,ul,div...)?

I receive data from the server, write it to the state, after that I need to create using React {DOM} inputs, the amount depends on what I received, is it possible to pass a function?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artyom, 2017-08-31
@artalar

Look at the official documentation about this, this is done in the context of the same React.
For example like this

render () {
  const list = this.state.list;

  return (
    <ul>
      {
        list.map(item => {
          return (
            <li>{item.title}</li>
          )
        })
      }
    </ul>
  )
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question