Can I have any other examples like, when the component is reused in another component, some part of the reused component should be hidden in another component.
When the user redirects to b page (i.e., b.js), the A page can show the full component, but the B page should not show the full component, instead it should only show the div which has className="sub-two" in /B page.
a.js
import React from "react";
class A extends React.Component {
render() {
return(
<div className="sub-one">
<input type="checkbox"></input
</div>
<div className="sub-two">
<input type="text"></input
</div>
<Link to="/B" ></Link>
)
}
}
b.js
import React from "react";
import A from "./a";
class A extends React.Component {
render() {
return(<A />)
}
}