React - Syntax error: 'return' outside of function

0 votes
1,310 views
added May 3, 2021 in React by lcjr First Warrant Officer (11,790 points)
// wrap the return<> inside the function
function functionWrapper() {
  
  const facebook = () => {
    window.open(
      `http://facebook.com/sharer.php?u=${window.location.href}`,
      '_blank',
    );
  };
  
  return (
    <>
    // your content goes here
    </>
  );
}

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...