react-cheatsheet

This repo is contains some useful opportunities for work with React.js library

View project on GitHub

Creating component (Создание компонента)

[EN]

React.js library allows us to create components in two different ways:

  1. jsx-syntax:
     return (
       <div className="App">
         <h1>Hi, I am a React-App</h1>
       </div>
     );
    
  2. Using createElement method:
      return React.createElement(
     'div',
      { className: 'App' },
      React.createElement(
       'h1',
       null,
       'Hi, I am a React-App')
      );
    

Notice. Examples above will have the same (equal) result.

[RU]

Библиотека React.js позволяет нам создвать компоненты двумя разными способами:

  1. С помощью jsx синтаксиса:
     return (
       <div className="App">
         <h1>Hi, I am a React-App</h1>
       </div>
     );
    
  2. Используя метод createElement:
    return React.createElement(
     'div',
      { className: 'App' },
      React.createElement(
       'h1',
       null,
       'Hi, I am a React-App')
      );
    

Примечание. Примеры выше будут иметь одинаковый результат.