Gatsby Training
  • About this training
  • Fundamentals
    • React
    • Gatsby
    • GraphQL
    • JAMStack
    • JSX
    • Webpack
  • Getting Started
    • Build your first Gatsby site
    • Project structure
    • Component structure
  • Components
    • About Components
    • Eyebrow
    • Button
    • Heading
    • Working with CSS
    • Movie Card
  • Gatsby Core Components
    • Gatsby Link
    • Gatsby Image
  • Data and GraphQL
    • Data sources
    • Connecting a data source
    • Using the GraphQL playground
  • CreatePages
    • createPages Function
    • Create a template
  • Resources
    • Gatsby and React Resources
    • Other resources
Powered by GitBook
On this page
  • Why JSX?
  • Component example with JSX

Was this helpful?

  1. Fundamentals

JSX

JSX is a syntax extension to Javascript and is use in React apps to describe what the UI should look like. JSX may look similar to a template language but it provides the full power of Javascript.

Here's an example of a simple JSX variable declaration:

const element = <h1>Hello, world!</h1>;

Why JSX?

React embraces the fact that rendering logic is inherently coupled with other UI logic: how events are handled, how the state changes over time, and how the data is prepared for display.

Component example with JSX

import React from "react"
function AboutPage(props) {
  return (
    <div className="about-container">
      <p>About me.</p>
    </div>
  )
}
export default AboutPage
PreviousJAMStackNextWebpack

Last updated 4 years ago

Was this helpful?