I want to pass onClick
callback to my rendered button via the render option, however at the moment I don’t think it’s possible, unless I’m doing something wrong here. The end goal is to toggle a loading state when I click login.
I’m guessing it’s due to this line
What I’d like to be able to do is pass in a function that can set a state, eg isLoading
, so when I click on the button, I can get some reaction
My component looks like this, and I want to pass an onClick to the LoadingButton
componenet.
<DamlHubLoginBtn
withButton
withToken
onLogin={(creds) => {
console.log("ON LOGIN");
if (creds) {
login(creds, admin);
}
}}
options={{
method: {
button: {
text: "Log Into Wallet",
render: () => (
<LoadingButton
onClick={() => {
// I CANT GET IT TO LOG
console.log("HI");
}}
loading={false}
loadingPosition="end"
sx={{ margin: 1 }}
variant="contained"
fullWidth
></LoadingButton>
),
},
},
}}
/>