Files
2018-10-16 21:32:40 +05:30

38 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Create a Component with Composition
localeTitle: Создание компонента с композицией
---
## Создание компонента с композицией
### Подсказка 1
Добавьте компонент, который будет отображаться в компоненте, в котором он должен отображаться.
### Подсказка 2
Используйте самозакрывающиеся теги JSX.
### Подсказка 3
Компонент, который будет отображаться, является ChildComponenet и должен быть представлен в ParentComponent
### Решение
Ниже будет предоставлен дочерний компонент ParentComponent, если необходимо:
```javascript
class ParentComponent extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
<h1>I am the parent</h1>
<ChildComponent />
</div>
);
}
};
```