-
Notifications
You must be signed in to change notification settings - Fork 19
Funky leopards #364
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
base: master
Are you sure you want to change the base?
Funky leopards #364
Conversation
burtonjong
left a comment
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.
Didn't feel like using typescript?? lol
| import React from "react"; | ||
|
|
||
| function App() { | ||
| const [userData, setUserData] = React.useState([]) |
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.
You don't have to do React.useState you can instead just import useState directly.
import { useState, useEffect } from "react";| function fullNames (searchValue) { | ||
| const names = userData.map((firstNames) => (firstNames.name.first.toLowerCase())) | ||
| const target = document.getElementsByClassName("name"); | ||
| if (names.indexOf(searchValue) !== -1) target[names.indexOf(searchValue)].scrollIntoView({ behavior: "smooth", block: "start" }) |
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.
The search shouldnt scroll to the user, rather it should filter and only show the user that has been searched. For example, if there was a name of John, when I type jo, Only names starting with jo should show.
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.
What's this for ? lol
No description provided.