Answer the question
In order to leave comments, you need to log in
How to refer to child components through dot in REACT?
There is a component:
// @flow
import * as React from 'react';
import Header from './ModalHeader';
import Body from './ModalBody';
import Footer from './ModalFooter';
export class Modal extends React.PureComponent<{}> {
render() {
const {
modalTitle,
modalBody,
modalFooter,
} = this.props;
console.log(this.props, 'Modal');
return (
<div className="modal">
<Header modalTitle={modalTitle} />
<Body modalBody={modalBody} />
<Footer modalFooter={modalFooter} />
</div>
);
}
}
// @flow
import * as React from 'react';
export default class Header extends React.PureComponent<{}> {
render() {
const {
children,
} = this.props;
console.log(this.props, 'Header');
return (
<div className="modal__header">
{children && (children)}
</div>
);
}
}
<Modal.Header>
1111
</Modal.Header>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question