function render(model){ const current = model.active_states[0] function addImage() { if (current.image_url) { return $("img", {src: model.active_states[0].image_url, style: {height: "70%", margin: "0 auto"}}) } else { return "No image available." } } return ( <div style={{textAlign: "center"}}> <h1>{model.active_states[0].name}</h1> {addImage()} </div> ); }