almost 2 years ago

Use Jquery to get DOM elements

React.js injects code into HTML block like this:

    <EditorForm />,

To use Jquery to accomplish the samething:

    <EditorForm />,

$("#content") along is not enough, because it returns a jquery object instead of a DOM object.

Why does React.js render function's return statement is surrounded by a parenthese?

This is because JavaScript does automatic semicolon insertion

When the following line is entered:

var test = 'str1'

The output is not an error, but instead str1 is assigned to variable test. This is because a semicolon has been inserted by js automatically like this:

var test = 'str1';

When working with React.js, this is what a typical render() looks like:

    return (
        <div className="form-group hovering-textarea-container">
            <input className="form-control input-lg" type="text" />

To make sure the entire div block is returned as a whole instead of just the first line, the parenthese are needed.

← Setup Sublime Text 3 for React.js development Reference globally installed NPM package →
comments powered by Disqus