Does reactjs extend javascript


Keywords:reactjs 


Question: 

In the tutorial there is the following code

class Board extends React.Component {
  renderSquare(i) {
    return <Square value={i} />;
  }

The return statement has text within angled brackets that are not quoted. Does the reactjs code gets preprocessed before sent to javascript interpreter ?


2 Answers: 

It's called JSX. Using it, you can write HTML Elements without using literals or strings. During compiling, a transpiler like Babel convert it into a createElement Object, which React later uses to insert HTML Element into DOM.

Learn more about it here:

 

Yes, it is called JSX, and it is a syntax extension to JavaScript. It will be transpiled (most popuparly by Babel) into React's createElement syntax.