Skip to content

Commit

Permalink
Optimization with Million js
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewdr committed Nov 1, 2024
1 parent a63743e commit 32ca029
Show file tree
Hide file tree
Showing 5 changed files with 1,049 additions and 28 deletions.
1 change: 1 addition & 0 deletions .million/store.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"encodings":["src\\components\\Snow.tsx","Snow",[6,13,53,1],[7,28,7,43],[9,4,15,10],[21,36,44,5],[47,8,51,10],[17,28,19,10]],"reactData":{"src\\components\\Snow.tsx":{"components":{"Snow":{"loc":[6,13,53,1],"nameLoc":[6,6,6,10],"captures":[{"loc":[6,13,53,1],"kind":512},{"loc":[7,28,7,43],"kind":4},{"loc":[9,4,15,10],"kind":128},{"loc":[9,4,15,10],"kind":1},{"loc":[17,28,19,10],"kind":128},{"loc":[17,28,19,10],"kind":1},{"loc":[21,36,44,5],"kind":128},{"loc":[21,36,44,5],"kind":1},{"loc":[47,8,51,10],"kind":16}]}},"externals":[{"kind":"import","loc":[1,0,1,47]},{"kind":"import","loc":[2,0,2,69]},{"kind":"import","loc":[3,0,3,68]},{"kind":"import","loc":[4,0,4,66]},{"kind":"export","loc":[55,0,55,20]}]}},"unusedFiles":["astro:scripts/before-hydration.js"],"mtime":null}
4 changes: 2 additions & 2 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { defineConfig } from 'astro/config';

import MillionLint from "@million/lint";
import react from "@astrojs/react";

// https://astro.build/config
Expand All @@ -14,5 +14,5 @@ export default defineConfig({
}
},

integrations: [react()]
integrations: [react(), MillionLint.astro()]
})
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@astrojs/check": "^0.9.4",
"@astrojs/react": "^3.6.2",
"@biomejs/biome": "1.9.4",
"@million/lint": "^1.0.11",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"astro": "^4.16.8",
Expand Down
6 changes: 3 additions & 3 deletions src/components/Snow.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { loadBasic } from "@tsparticles/basic";
import type { Container, ISourceOptions } from "@tsparticles/engine";
import Particles, { initParticlesEngine } from "@tsparticles/react";
import { useEffect, useMemo, useState } from "react";
import { useEffect, useMemo, useState, useCallback } from "react";

const Snow = () => {
const [init, setInit] = useState(false);
Expand All @@ -14,9 +14,9 @@ const Snow = () => {
});
}, []);

const particlesLoaded = async (container?: Container): Promise<void> => {
const particlesLoaded = useCallback(async (container?: Container): Promise<void> => {
console.log(container);
};
}, []);

const options: ISourceOptions = useMemo(
() => ({
Expand Down
Loading

0 comments on commit 32ca029

Please sign in to comment.