Entry point for the React application. Requires React and React DOM as dependencies, so it can render content to the page. Contains the Main
React class component, i.e., class Main
extends the React.Component
class and uses its render()
function to return <App />
.
Everything rendered through index.js is rended to the DOM in the #root
div in index.html
.
Counter
has a constructor function that takesprops
—the React component properties—as a parameter. The constructor also contains thestate
of theCounter
component, a property that tracks the current number on the counter displayed in the DOM.
The Counter
class component has three methods:
handleDown
- takes anevent
object as a parameter and changes thestate
ofCounter
to a number one less than the currentstate
(usingthis.setState
).handleUp
- identical todecrement
, but instead increases the current state by one.render
- defines the markup rendered to the DOM: two<a>
tags (for decrementing and incrementing) and a<h4>
containing the current count. This is an inherited method fromReact.Component
App
uses its inheritedrender()
method to return the three main components as markup:Header
,Counter
, andFooter
.
React class component containing markup for the header.
React class component containing markup for the footer.
Sass CSS styling for the entire application.
npm run test