Skip to content

Instantly share code, notes, and snippets.

@react-ram
Created November 25, 2019 03:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save react-ram/8315da25d47ec77bf82f2615da26da94 to your computer and use it in GitHub Desktop.
Save react-ram/8315da25d47ec77bf82f2615da26da94 to your computer and use it in GitHub Desktop.
Basics - Introducing JSX - example 2.
import React from "react";
import ReactDOM from "react-dom";
function formatName(user) {
return user.first + " " + user.last;
}
const user = {
first: "ram",
last: "charan"
};
const element = <h1>hello {formatName(user)}</h1>;
ReactDOM.render(element, document.getElementById("root"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment