Home > Web Front-end > JS Tutorial > body text

Explain common problems and solutions in react.js

韦小宝
Release: 2018-03-14 10:00:30
Original
1699 people have browsed it

React.js is a library that helps you build page UI. We have summarized the common problems in react.js. Everyone is interested in react.js. If you don’t know much about it or don’t know much about it, you can refer to it! Without further ado, let’s get to the topic!

1. Why can’t it be rendered after adding an extra tag in return


Example: When we write it in the following way

render: function () {
          return (
             <h2>齐天大圣</h2>        
          );
        }
Copy after login

can render normally, but what if we add another tag?

render: function () {
          return (
             <h2>齐天大圣</h2>
             <h2>猪八戒</h2>         
          );
        }
Copy after login

There is no rendering effect at this time, what should I do? Just wrap one tag outside the two h2 tags. Only one label can be rendered by default after return.

 render: function () {
          return (
          <p>
             <h2>齐天大圣</h2>
              <h2>猪八戒</h2>
        </p>

          );
        }
Copy after login

The above is all the content of this article. This article may not be the most complete. You can search related articles on the PHP Chinese website !

Related recommendations:

CSS usage in React.js

react.js learning

The above is the detailed content of Explain common problems and solutions in react.js. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!