-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bo ce filter list #22
Conversation
Visit the preview URL for this PR (updated for commit 0aa76d9): https://tcl-71-smart-shopping-list--pr22-bo-ce-filter-list-km16z2qf.web.app (expires Tue, 27 Feb 2024 10:10:29 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 1e7ade9d0f374c4ddb5d7ab6fc541062fc7a1ab4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!! Well done!!
src/components/SearchList.jsx
Outdated
const SearchList = ({ data, setNewList }) => { | ||
const [value, setValue] = useState(''); | ||
|
||
const handlefiltering = (e) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can renamed with handleFiltering
src/components/SearchList.jsx
Outdated
const [value, setValue] = useState(''); | ||
|
||
const handlefiltering = (e) => { | ||
const userinput = e.target.value.toLowerCase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
userInput
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable names updated!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job! The new feature works perfectly and meets all the requirements ✨
As a suggestion, I wonder if it wouldn't be clearer if the name of SearchList were something like SearchForm (given that it is a form similar to the ListForm we created in the previous issue with Celine).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your effort.
Description
This PR adds a new component,
SearchList.jsx
, which can be used to filter theList
view based on current input. The filtering is used to display only items which include the current input's value. The component also includes abutton
to clear the input field.For this issue we had to deepen our understanding of React's component lifecycle and the way the
useState
hook updates its values. This came to be while having to update the list being displayed dynamically and its initial loading.Related Issue
Closes #7
Acceptance Criteria
List
view, above the shopping list<label>
!) which narrows down the list as the user typesType of Changes
Updates
Before
After
Testing Steps / QA Criteria
git pull origin bo_ce_filter_list
npm start