SnapShot icon indicating copy to clipboard operation
SnapShot copied to clipboard

Clear search input on submit

Open Ishaan-11 opened this issue 3 years ago • 5 comments

https://github.com/Yog9/SnapShot/blob/406d69553793e0d85871069326bfa22ee1566ad7/src/App.js#L13 If this line is used for clearing the search input then it is not being cleared. I suggest adding setSearchEntry(""); after handleSubmit call https://github.com/Yog9/SnapShot/blob/406d69553793e0d85871069326bfa22ee1566ad7/src/components/Form.js#L12

Ishaan-11 avatar Jan 07 '21 15:01 Ishaan-11

ishaan can you pls tell me how this handlechange is working i dont understand it.

kushalShukla-web avatar Sep 16 '21 11:09 kushalShukla-web

sorry ishaan but i can't see my committed code in ur main code. im new in opensource.

kushalShukla-web avatar Sep 16 '21 15:09 kushalShukla-web

Hi @kushalShukla-web , this repo belongs to @Yog9 , so for your changes to reflect you need create Pull Request on the repo of @Yog9 . I would recommend this video for open source guidance. I hope this helps you.

Ishaan-11 avatar Sep 28 '21 15:09 Ishaan-11

I want to work on this issue. Please assign me.

SOMKUVAR avatar Apr 26 '23 21:04 SOMKUVAR

Hi @Yog9 , I have a question regarding the handle submit function which is written in App.js. We initialized the searchEntry state in Form.js and just sending the updated searchEntry to handle submit function. But we cannot update the state and clear the search bar. But instead we can control handle submit function in Form.js and update the searchEntry state. My fix: I removed the handleSubmit prop in <Header /> and removed the handle submit function from App.js and handle that in Form.js. Is this the correct fix? Or anything else is required, please let me know. Code change in App.js:

**Code change in Form.js:** const handleSubmit = (e, history, searchEntry) => { e.preventDefault(); e.currentTarget.reset(); let url = `/search/${searchEntry}`; history.push(url); **setSearchEntry('')** };

Dhruva21 avatar Jul 29 '23 21:07 Dhruva21