Skip to main content
Public

Share visualization

Loading preview…

Smiley Face Part IV (React Components & ES6)

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Smiley Face Part IV (React Components & ES6)

1
IIlgar Akalın
Last edited Sep 16, 2021
Created on Sep 16, 2021

This example shows a yellow smiley face built from SVG primitives, with yellow circular background, two black eyes, and a curved mouth. It demonstrates how to combine React components with D3’s arc generator for the mouth path. The code uses React and ReactDOM for rendering, D3’s `arc()` method for path data, and ES6 features like arrow functions, destructuring, and template literals. The face is centered on a 960×500 canvas, with eyes offset by fixed pixel values and the mouth drawn as an arc between specified angles.

AI-generated description

Part IV

  1. React Components
  2. React Props
  3. JSX transpilation
  4. ES6 (ECMAScript version 6) Background: Wiki.

ECMAScript is another name for javascript.

  1. ES5 Functions vs. ES6 Arrow Functions
  2. Variables: ES5 <span style="color:red">var</span> vs. ES6 <span style="color:red">let</span> and <span style="color:red">const</span>.
  • ES5 javascript syntax: (oldschool 2009-2015)
var square = function(x) { return x * x }
  • ES6 2015 new features:
    • ES6 modules
import * as moduleName from "..."; export const Foo
- arrow function with ( ( ) => { }) syntax
const square = x => x * x;
const square = x => (x * x);
  1. ES6 Destructuring
let { a, b } = object;

Comments

Sign in to join the discussion.

MIT Licensed