DEV Community

Rajasekar Thangavel
Rajasekar Thangavel

Posted on

Exercise 1

import React, { useEffect, useState } from "react";

const HelloWorld = () => {
  const [result, setResult] = useState([]);
//   useEffect(() => {
//     filterDeveloper();
//   }, []);
  const data = [
    {
      name: "Rajasekar",
      title: "Developer",
    },
    {
      name: "Ganesh",
      title: "Manager",
    },
    {
      name: "Arun",
      title: "Developer",
    },
  ];

  const filterDeveloper = () => {
    let test = data.filter((item) => {
      return item.title === "Manager";
    });
    setResult(test);
  };
  const style1 = {
    color:"white"
  }
  const style= {
    backgroundColor: "red",
    ...style1
  }



  return (
    <>
    {result.map((item, index) => (
        <div key={item.name} className="test" style={style}>
          {index + 1} {item.name} - {item.title}
        </div>
      ))}
      <button onClick={filterDeveloper}>Test</button>
    </>
  );
};

export default HelloWorld;

Enter fullscreen mode Exit fullscreen mode

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs