i have created dropdown component like
const CONTACTS_LIST = () => (
<select>
{
list_data &&
list_data .map((h, i) =>
(
<option key={i} value={h.list_id}>{h.name}</option>))
}
</select>
);
can it be possible to render html with json response like this ?. i can set reponse in constants using setstate . but just wanted to know that is it also possible ?
const CONTACTS_LIST = () => (
fetch(URL)
.then(response => response.json())
.then(json => {
(
render '
( <select>
{
json &&
json.map((h, i) =>
(
<option key={i} value={h.list_id}>{h.name}</option>))
}
</select>
)
)
);
please suggest