Reactjs tag: br and ajax

My question is divided into two parts:

  • I know how to make an ajax request to a third-party api on componentDidMount, but when I tried to make the same request with a function in the click event, this did not happen?

  • I also tried using the <br> tag to respond to line breaks, but it does not display at all and does not give me an error.

Can anyone help me understand why this is happening and how can I solve these problems?

+6
source share
1 answer
  • That should work. Send a working example (e.g. to jsfiddle) that shows how you have problems.

  • Try it <br /> . All self-closing tags must have a final slash in React.

(In the future, it is best to post individual questions.)

+20
source

All Articles