MDBRangeInput not working with typescript


Topic: MDBRangeInput not working with typescript

MaximeGheraille pro asked a week ago

Expected behavior

I expect to get a console.log and a state update with the value when changing the rangeInput

Actual behavior

The handelChange does not console log or change the state to the changed value

Resources (screenshots, code snippets etc.)

This is my code

const Player = () => {
    const [volume, setvolume] = useState(100)
    const handleChange = (value: any) => {
        console.log(value);
        setvolume(value)
    };
    return (
        <div className="d-flex align-items-center w-xl-50 w-lg-50 w-md-50">
            <MDBIcon className="mr-2 ml-4 d-none d-sm-block" icon="volume-up" />
            <MDBRangeInput className="d-none d-sm-block" min={0} max={100} value={volume} getValue={() =>handleChange} />
        </div>
    )
}
export default Player

Piotr Glejzer staff answered 6 days ago

You didn't pass a parameter to handleChange.

It should be like that :

getValue={handleChange}

or

getValue={(e)=> handleChange(e)}


MaximeGheraille pro answered 6 days ago

@Piotr Glejzer

I did try those but i keep getting this error. enter image description here


Piotr Glejzer staff commented 5 days ago

Ok, this is a bug. I checked this and this is an error with type declaration in range input and this is a reason why this error is showing up. I added the task to fix it. Sorry about that.


Please insert min. 20 characters.
Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: React
  • MDB Version: 4.27.0
  • Device: PC
  • Browser: chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: No