Home  >  Article  >  Web Front-end  >  Explain common problems and solutions in react.js

Explain common problems and solutions in react.js

韦小宝
韦小宝Original
2018-03-14 10:00:301735browse

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>        
          );
        }

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

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

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>

          );
        }

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!

Statement:
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