Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quickstart react #82

Open
mminin opened this issue Jan 20, 2023 · 1 comment
Open

Quickstart react #82

mminin opened this issue Jan 20, 2023 · 1 comment

Comments

@mminin
Copy link

mminin commented Jan 20, 2023

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>
@pslootweg
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants