<script src="https://cdnjs.cloudflare.com/ajax/libs/react/17.0.2/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/17.0.2/umd/react-dom.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script type="text/babel">
const { useState, useEffect } = React;
const [employees] = useState([
department: 'Development',
email: 'david@example.com',
phone: '+1 123-456-7890',
address: '123 Main Street, City, State, Zip',
skills: ['HTML', 'CSS', 'JavaScript', 'React'],
{ id: 'proj1', name: 'E-commerce Website', status: 'In Progress' },
{ id: 'proj2', name: 'Portfolio Website', status: 'Completed' },
role: 'Frontend Developer',
department: 'Development',
email: 'andrew@example.com',
phone: '+1 987-654-3210',
address: '456 Elm Avenue, City, State, Zip',
skills: ['HTML', 'CSS', 'JavaScript', 'Vue.js'],
{ id: 'proj3', name: 'Dashboard App', status: 'In Progress' },
{ id: 'proj4', name: 'Blog Platform', status: 'Completed' },
role: 'Backend Developer',
department: 'Development',
email: 'smith@example.com',
phone: '+1 555-123-4567',
address: '789 Oak Road, City, State, Zip',
skills: ['Node.js', 'Python', 'MongoDB', 'RESTful APIs'],
{ id: 'proj5', name: 'User Management System', status: 'In Progress' },
{ id: 'proj6', name: 'Task Tracking App', status: 'Completed' },
email: 'emily@example.com',
phone: '+1 444-222-3333',
address: '555 Pine Lane, City, State, Zip',
skills: ['Adobe XD', 'Sketch', 'Illustrator', 'Prototyping'],
{ id: 'proj7', name: 'Mobile App Redesign', status: 'In Progress' },
{ id: 'proj8', name: 'Website Redesign', status: 'Completed' },
const [result, setResult] = useState('');
const myFunction = () => {
const foundEmployee = employees.find((employee) => employee.id === '4');
setResult(foundEmployee ? JSON.stringify(foundEmployee) : 'Employee not found');
<div className='container'>
<h2>React js array find function</h2>
<p>Find Employees whose id is 4</p>
<button onClick={myFunction} className="btn btn-primary">
ReactDOM.render(<App />, document.getElementById("app"));
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.24);