welcome-apps
welcome-apps copied to clipboard
Quickstart react
The tutorial does not explain how the colour button in Customise View supposed to change the background colour. Using colour picker has no effect. Probably because a hook for it is missing in App.js? It seems to be necessary to add the following line under const App:
const [background_color, setSettingsBG] = useState('red');
And then a handler under useEffect()
monday.listen("settings", (res_set) => {
setSettingsBG(res_set.data.background_color);
});
and finally assign a style to the div:
const mystyle = {
backgroundColor: background_color
};
console.log(background_color);
return (
<div className="App"
style={mystyle}
>
<AttentionBox
title="Hello Monday Appssss!"
text={attentionBoxText}
type="success"
/>
</div>
More than that, you will need to persist the setting for your own App and load them at the start of the App execution, otherwise each invocation of the app will start with undefined settings.