Currently, I have 2 class about container wrapper for render content as a child. It working only when I use styled component like containerEz class but not in BaseTemplateContainer class
If I want to fix class BaseTemplateContainer to re-render when this.props.children change, How to do it?
class containerEz It re-render when children prop was change
const ContainerEz = ({children}) => {
const Wrapper = styled.div`
padding: 0 20px;
width: 100%;
@media (min-width: 768px) {
padding: 0 60px;
}
`;
return (
<Wrapper>
{children}
</Wrapper>
);
}
export default ContainerEz;
class BaseTemplateContainer It's not re-render when children prop was change
class BaseTemplateContainer extends Component {
state = {
}
render() {
return (
<div>
{this.props.children}
</div>
);
}
}
export default BaseTemplateContainer;
Aucun commentaire:
Enregistrer un commentaire