Read multiple js objects based on if else statement [closed]

I am reading multiple js objects for a local file, I want to get an object based on search params and render the object in the h2 tag . Please help

I tried updating the state from if statements and want to render the updated statement