Skip to content

Conversation

@VyapakBansal
Copy link

No description provided.

Copy link
Member

@burtonjong burtonjong left a 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([])
Copy link
Member

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";

Comment on lines 13 to 16
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" })
Copy link
Member

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.

Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants