Answer the question
In order to leave comments, you need to log in
What is the correct way to use this.props.children?
It is necessary that when switching to
<Route path="/user/:username/settings" component={UserProfileContainer.Settings} />
import UserProfileContainer from './containers/UserProfile';
<Route path="/user/:username" component={UserProfileContainer} />
return (
<UserProfileDetail
name={name}
/>
);
<main className="content">
<div className="title">
<h1>{name}</h1>
<div>1 ссылка</div>
<div>2 ссылка</div>
<div>3 ссылка</div>
</div>
<div className="content">
<h1>{this.props.children}</h1>
</div>
</main>
Answer the question
In order to leave comments, you need to log in
What is the correct way to use this.props.children?
import React from 'react';
import ReactDOM from 'react-dom';
const SomeComponent = ({ name }) => (
<span>{name}</span>
);
const SomeContainer = ({ children }) => (
<div>{children}</div>
);
const Example = () => (
<SomeContainer>
<SomeComponent name="John" />
</SomeContainer>
);
ReactDOM.render(
<Example />,
document.getElementById('root');
);
<div id="root">
<div>
<span>John</span>
</div>
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question