МК
Size: a a a
МК
S
SR
MZ
МК
АШ
MD
О
О
О
HM

ER
DN
const [modal, setModal] = useState(false);
const func = ()=>{
return setModal;
};
useEffect(()=>{
props.getChildCallback(func);
}
const [modalChildCallback, setModalChildCallback] = useState(null);
const getChildCallback = (func) =>{
setModalChildCallback(func);
};
const openModal =()=>{
modalChildCallback(true);
};
<Nav>
{
childPath === location.pathname?
<React.Fragment>
<Link to="/stats">User Statistics</Link>
<div></div>
{`${selectedUser.first_name} ${selectedUser.last_name}`}
<button
onClick={openModal}
>Update Name
</button>
</React.Fragment>
: <span> User Statistics </span>
}
</Nav>
ДС
class Timer extends React.Component {
constructor(props) {
super(props);
this.state = { seconds: 0 };
}
tick() {
this.setState(state => ({
seconds: state.seconds + 1
}));
}ДС
this меня выносит простоТ
class Timer extends React.Component {
constructor(props) {
super(props);
this.state = { seconds: 0 };
}
tick() {
this.setState(state => ({
seconds: state.seconds + 1
}));
}ДС
хуками а тут классы
может есть где то переводчик с классов на хукиДС
ДС