Does there exist hooks called just before “return” in function component? [closed]

In class component

render(){
  if (temp){ // preparation for making HTML
    text = <div>OK</div>
  }
  else {
    text = <div>NG</div>
  }
  return (<div>{text}</div>);
}

However in function component

return returns html directly ,so where can I put the preparation?

There exists some hooks called just before the return?