Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Making a Smiley Face with React

Public visualization

Viewing a saved revision (read-only)

2e61f7c72735475e8db5939b4d34335e

Making a Smiley Face with React

0 stars2🌍 Public
Jjjacobatandover
Last edited Jul 4, 2021
Created on Jul 3, 2021

This example shows a smiley face rendered as a scalable vector graphic using React. The face consists of a yellow head and two black eyes, with geometric properties such as center coordinates, offsets, and radius defined as JavaScript constants in JSX. The code uses React 17 and ReactDOM to mount the component into the DOM, while SVG circles handle the drawing. The approach demonstrates how JSX enables dynamic math-based positioning instead of hardcoded attributes.

AI-generated description

A bare minimum HTML page demonstrating use of CSS and JavaScript.

See also React Starter.

Half way towards a smiley face -- we used CSS to make the margins and the colors. We used SVG to make the circles. Feeling frustrated that we couldn't use math to define the DOM structure and use JSX to write HTML in JS and math from JS