자바개발자 리엑트 배우기 (JSX, Es6)

Eungho won·2023년 5월 29일
0

React&JavaScript

목록 보기
2/6

JSX stands for JavaScript XML. It is a syntax extension for JavaScript, which was written to be used with React. JSX is not natively understood by the browser, so it has to be compiled down to regular JavaScript using a compiler like Babel.

JSX looks a lot like HTML and it allows developers to write HTML-like syntax in their JavaScript code. This HTML-like JavaScript code is just syntactic sugar for calling React.createElement, but it makes the code more readable and easier to write.

Here's an example of JSX:

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

In this example, the element constant is defined using JSX, which looks like HTML.

ES6 stands for ECMAScript 6, which is also known as ECMAScript 2015. ECMAScript is the standard that defines JavaScript, the language that we all know and love. The terms ES6 and ES2015 are often used interchangeably.

ES6 introduced a number of significant improvements and new features to JavaScript, such as:

  • Arrow functions: They provide a new way of defining functions in a shorter syntax.

  • Template strings: They allow embedded expressions and multi-line strings.

  • Promises: They provide a way to handle asynchronous operations.

  • Classes: They provide a simpler syntax for defining complex objects with their own prototypes.

  • Modules: They provide a way to split your code into reusable modules.

  • Destructuring assignment: It allows unpacking values from arrays, or properties from objects, into distinct variables.

  • Default, Rest, Spread: New ways to handle function parameters.

  • Let and Const: New ways to declare variables.

React and JSX are often used with features from ES6 and later versions, but they are not required to use React. You can write React with ES5 syntax, but it's often more verbose and harder to read compared to ES6+ syntax.

profile
kill to code

0개의 댓글