Currently, I'm utilizing a Material UI button within my React application. Despite changing the state, the button remains visible on the screen. Here's the relevant code snippet:
function MainPage() {
const state = useSelector(state => state.loginDetails.state)
const [visibilitySetting, setVisibility] = useState(true)
useEffect(() => {
console.log(state.loginType)
if(state.loginType=="google")
{
setVisibility(false)
}
}, [])
return (
<div style={{ height: 400, width: '100%' }}>
<Button color="primary" variant="contained" style={{display:visibilitySetting}} >
Group
</Button>
)
After verifying that state.loginType
is indeed google
,
I attempted setting display to none but observed no visible change in the button.