From d09194f05a372e3ed136aa288ae76cae8c1dc641 Mon Sep 17 00:00:00 2001
From: Jarred Sumner <jarred@jarredsumner.com>
Date: Sun, 20 Jun 2021 18:15:13 -0700
Subject: Support live-reload and fallback

Former-commit-id: c3f9d77391589b65951616a632af87107fba469f
---
 .../src/components/RenderCounter.tsx                | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 demos/react-fast-refresh-test/src/components/RenderCounter.tsx

(limited to 'demos/react-fast-refresh-test/src/components/RenderCounter.tsx')

diff --git a/demos/react-fast-refresh-test/src/components/RenderCounter.tsx b/demos/react-fast-refresh-test/src/components/RenderCounter.tsx
new file mode 100644
index 000000000..ed2f00b56
--- /dev/null
+++ b/demos/react-fast-refresh-test/src/components/RenderCounter.tsx
@@ -0,0 +1,21 @@
+import React from "react";
+
+export function RenderCounter({ name, children }) {
+  const counter = React.useRef(1);
+  return (
+    <div className="RenderCounter">
+      <div className="RenderCounter-meta">
+        <div className="RenderCounter-title">
+          {name} rendered <strong>{counter.current++} times</strong>
+        </div>
+        <div className="RenderCounter-lastRender">
+          LAST RENDER:{" "}
+          {new Intl.DateTimeFormat([], {
+            timeStyle: "long",
+          }).format(new Date())}
+        </div>
+      </div>
+      <div className="RenderCounter-children">{children}</div>
+    </div>
+  );
+}
-- 
cgit v1.2.3

