Can not add code comment inside GatsbyJS function


   export default () => {
     // your comment here
      return <div>
               <NavBar />
               {/* another comment here*/}
               Hello People
               <hr />
               <Link to="/blog/">Blog Page</Link>

Note that I’ve self-closed the empty tags.

Adding the comment of Oliver:

To be precise, the syntax of HTML inside JS is called JSX, and it’s a syntactic extension to JavaScript typically employed by React (and thus GatsbyJS) for cleaner code. To embed a JS expression in JSX you need to use curly braces like this: {some expression}. Note that the expression can be a comment, hence the {/*comment*/}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top