Самый простой вариант:
import React, {useState} from 'react';
function Box(props: {className?: string}) {
return <div className={props.className}>Сюда добавить класс</div>;
}
function Button(props: {
setBoxClassName: React.Dispatch<React.SetStateAction<string | undefined>>,
}) {
return <button onClick={() => {
props.setBoxClassName(w => w ? undefined : 'd-none');
}}>Клик</button>
}
function App() {
const [boxClassName, setBoxClassName] = useState<string | undefined>();
return <>
<Box className={boxClassName}/>
<Button setBoxClassName="setBoxClassName"/>
</>;
}