I've created a custom button component based on Material-UI's Button component, so I can overlay a loading circle whenever an action is pending. However, React complains with the following:
Warning: Received false
for a non-boolean attribute loading
.
If you want to write it to the DOM, pass a string instead: loading="false" or loading={value.toString()}.
Here's what my component looks like. Thanks in advance!
import * as React from 'react'
import { ButtonProps } from '@material-ui/core/Button'
import { Button, CircularProgress } from '@material-ui/core'
interface IProps extends ButtonProps {
loading: boolean
}
export const LoadingButton = (props: IProps) => {
const { disabled, loading } = props
return (
<div className='button-container'>
<Button {...props} disabled={disabled == true || loading == true}/>
{loading == true && (
<CircularProgress size={24} className='button-progress' />
)}
</div>
)
}