Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Челендж: Стилізація за Допомогою CSS Файлу | Стилізація в React Додатках
Опановуємо React
course content

Зміст курсу

Опановуємо React

Опановуємо React

4. React в Реальному Світі

Челендж: Стилізація за Допомогою CSS Файлу

Завдання

Перейдемо до створення компонента Alert, який буде відображати всі елементи, передані як дочірні, і застосовувати до них певні стилі. Завдання полягає в наступному:

  1. Створіть компонент Alert, який містить елемент div.
  2. Елемент div повинен мати ім'я класу alert.
  3. Елемент div повинен мати проп children в якості вмісту.
  4. Елемент div повинен мати наступний CSS.
  1. To create a div element in the component, use <div>...</div>.
  2. To pass props.children as the text content enclose it within {...} and set props.children. Result: <div>{props.children}</div>.
  3. To add a class name to the div element, use the className attribute and set it to alert. Result: className="alert".
  4. To import the file with styles in the index.js file, use import statement and provide the correct path to the file. Result: import './index.css'.
  5. To apply styles to the div element, use the class name selector .alert and insert the styles from the task.

Все було зрозуміло?

Секція 2. Розділ 7
We're sorry to hear that something went wrong. What happened?
some-alt