state: {
from: location.pathname
}
from
ничего, тогда не рисуем кнопку useEffect(() => {
ref.current = depVar;
}, [depVar]);
db.json
поле "users": [{email: "test@test.com", password: "1234"},...]
/register
и /login
/register
добавлять пользователя в "users"
, а в /login
искать пользователя в "users"
- ссылка на докуimport PropTypes from 'prop-types';
class Component extends React.Component {
render() {
return (
<h2>{this.props.title}</h2>
);
}
}
Component.propTypes = {
title: PropTypes.string
};
{Object.keys(profile.contacts).map((key) => {
return (
<React.Fragment>
<TextField
key={key}
className={classes.gutters}
margin='dense'
fullWidth
variant='outlined'
id='standard-basic'
name={`contacts.${key}`}
label={key}
value={`values.contacts.${key}`}
onBlur={handleBlur}
onChange={handleChange}
error={`touched.contacts?.${key}` && Boolean(`errors.contacts?.${key}`)}
helperText={`touched.contacts?.${key}` && `errors.contacts?.${key}`}
/>
</React.Fragment>
)
})}
show
при первом клике и убирать при следующем. Тогда ваш код должен выглядеть так:window.addEventListener("load", ()=>{
let burger = document.querySelector("#desctop-header .burger");
let menu = document.querySelector("#desctop-header .header-menu-wrapper");
burger.addEventListener("click", ()=>{
menu.classList.toggle("show");
});
});
onChange={(e) =>
setTest(
produce((draft) => {
draft.conditions.forEach((c) =>
c.conditionProperties.forEach((prop) => {
if (prop.propertyName === item.propertyName) {
prop.propertyValue = e.target.value;
}
})
);
})
)
}
const LanguageSwitcher = () => {
const { locales, locale, asPath, reload } = useRouter();
return (
<div className="multilang">
{locales.map((lng) => {
if (lng === locale) return null;
return (
<>
<p className="switcherlanguage">{lng}</p>
<Link href={asPath} locale={lng} key={lng}>
<a>
<svg
width="28"
height="28"
viewBox="0 0 32 32"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M26 12L16 22L6 12"
stroke="black"
stroke-opacity="0.87"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</a>
</Link>
</>
);
})}
</div>
);
};
const lastBusinessWeekStart = subBusinessDays(new Date(), 7);
const lastBusinessMonthStart = subBusinessDays(new Date(), 30);
// фильтр неделя:
test.filter(({ date }) => isWithinInterval(
new Date(date),
{ start: lastBusinessWeekStart, end: new Date() }
));
//фильтр месяц:
test.filter(({ date }) => isWithinInterval(
new Date(date),
{ start: lastBusinessMonthStart, end: new Date() }
));