Topic: MDBDatePicker doesn't clear state

amitkarmacharya@impresst priority asked 1 year ago

*_Expected behavior_*The documentation says MDBDatepicker will clear state if you assign the a state to the value property and update it outside the component.

I have a clearFilter() which clears the state to "", but the Date picker doesnt' update.*_Actual behavior_*The date picker doesn't clear after it's state is updated to null or empty string.

Resources (screenshots, code snippets etc.)

import React, { useState } from "react";
import { MDBDatePicker } from "mdb-react-ui-kit";

const DatePicker = () => {
  const [startDate, setStartDate] = useState("");

  const clearFilter = () => {
  return (
        onChange={(value) => {
      <button onClick={clearFilter}>clearFilter</button>

export default DatePicker;

Wojciech Staniszewski staff commented 1 year ago

Could you fix your code sample? I think it's missing some code.

amitkarmacharya@impresst priority commented 1 year ago

I was able to resolve this issue by installing the essential package. The issue was with the package that comes in the admin-dashboard template. That one is buggy and doesn't work consistently. Having solved this issue, I ran into another issue in the essential package: the dropdown link is not available in that package.

To resolve that issue, I tried installing the advanced package that didn't fix anything. The advanced package is missing more packages, so I reverted back to using the essential package.

I would really appreciate it if someone emailed me what package to install. I am currently on the advanced subscription.

Wojciech Staniszewski staff commented 1 year ago

Did you try to reinstall the package and update it to the newest version? Maybe clear the npm cache if it will not help?

Wojciech Staniszewski staff commented 1 year ago

I checked your code, and every time it was working fine

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB React
  • MDB Version: MDB5 4.0.0
  • Device: windows
  • Browser: chrome
  • OS: windows 11
  • Provided sample code: No
  • Provided link: No