#include "useState.cpp";
#include "Display.cpp";

long timer = 0;

Component component;

useState<int> counter {1};

void Header(int counter) {
  Serial.println("Counter: " + String(counter));
}

void setup() {
  Serial.begin(115200);
  Serial.println("Hello, ESP32!");
}

void loop() {
  // INCREMENT BY 1 EVERY 1s
  if (millis() - timer > 1000) {
    timer = millis();
    counter.set(counter.get() + 1);
  }
  // DISPLAY
  component.render(Header, counter);
}