The simulation of API value can be change manually to rendering the elements. Change the value to 1,2,3 on this. For example, the below value are using 2.
const [apiResponse, setApiResponse] = useState('2');
Thus, it'll rendering this under buddyPrompt_answer
{apiResponse === '2' && <BuddySearchListing />}
Here's the full code
import React, { useState, useEffect } from 'react';
import BuddySearchText from './search/BuddySearchText';
import BuddySearchListing from './search/BuddySearchListing';
import BuddySearchAgent from './search/BuddySearchAgent';
const BuddyPromptResult = () => {
// State to simulate API response
const [apiResponse, setApiResponse] = useState('2');
// Function to manually set the API response
const setManualApiResponse = (response) => {
setApiResponse(response);
};
return (
<div className="buddyPrompt_answer">
{apiResponse === '1' && <BuddySearchText />}
{apiResponse === '2' && <BuddySearchListing />}
{apiResponse === '3' && <BuddySearchAgent />}
</div>
);
};
export default BuddyPromptResult;