setValue(prevValue => prevValue + number);
setValue(prevValue => (prevValue + number).slice(0, 3));
display: none
в React разработке использовать не принято.state = {
inputEntry: '',
}
submitHandler
заменит const payload = event.target.value
на const payload = this.state.inputEntry
handleInputChange = (e) => {
this.setState({inputEntry: e.target.value})
};
const Example = ({ disabled, onChange }) => {
const [isActive, setIsActive] = useState(false);
const handleClick = useCallback((e) => {
e.stopPropagation();
if (disabled) return;
setIsActive(!isActive);
onChange(!isActive);
}, [isActive, disabled]);
return <Switch onClick={handleClick} />;
};
selector{
display: flex;
align-items: left;
max-width: 40px;
overflow-x: hidden;
white-space: nowrap;
}
text-overflow: ellipsis;
if (!someCondition) return null;