Topic: Updating input value by setting state
Jakub Strebeyko staff answered 7 years ago
onKeyUp
event that would be clearing the search query inside the <Input/>
component?
Best,
Kuba cmykprnt pro commented 6 years ago
Hi Jakub, I kind of solved my problem by a trick like the one you said, but I still have the main question. Why MDB React doesn't support Controlled Component on Inputs? It's always recommended to use Controlled Components in React vs Uncontrolled. BestJakub Strebeyko staff commented 6 years ago
Hello cmykprnt, Thanks for reaching out with this question! Although I would not agree that it is <em>always recommended</em> to go for Controlled Components, it is a fact that MDB React inputs should be controlled, and they are not, currently. We were discussing few edge-cases, in which internal state of the component could be useful, but we do start to realize the inputs is mostly used for forms creation, and as such should derive its value from props. We are working on that as we speak - the upcoming release will present the inputs as components fully controlled with props. With Best Regards, KubaAram Muradyan commented 5 years ago
Hi,do you have any solution for < input > values, i can't take data from props, Reagrds,Aram.
Jakub Chmura staff premium commented 5 years ago
Hi, @Aram Muradyan
Please use component to control its value. But if you want to use a native you should control it by yourself. Here is a link to the documentation: https://mdbootstrap.com/docs/react/forms/inputs/#docsTabsAPI
Best, Kuba
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: No
- Technology: MDB React
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No