how do i make a really simple search engine

to find certain components first by their full name then by their first letter I’m using react java script .right now I’m using an array if objects “`
objects:[
{
name:’bicyle’,
details:

this would be a Component about bicyle

            },
            {
                name:'table',
                details:<p>this would be a Component about tables</p>

            },
            {
                name:'cars',
                details:<p>this would be a Component about cars</p>

            },
            {
                name:'people',
                details:<p>this would be a Component about people</p>

            },
    
        ],

 to do this and the and a method that  loops through the array checking the each objects.name to see if they match the state called *caller* which is a string that the user types then if *caller* matches objects.name then you'll set the empty state called *eye* to equal objects.details
onChange(a){
    this.setState({
        caller:a
    })
    this.state.objects.map(function(x){
        
        if (x.name == this.state.caller){
            this.setState({
                eye:this.state.objects[x]
            })
        }

    })
}