Skip to main content
100%

Making a Smiley Face with React

✓ Published2🌍 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

MIT Licensed

Similar vizzes