puruvj / neoconfetti Goto Github PK
View Code? Open in Web Editor NEWConfetti in Svelte
Home Page: https://www.npmjs.com/package/svelte-confetti-explosion
License: MIT License
Confetti in Svelte
Home Page: https://www.npmjs.com/package/svelte-confetti-explosion
License: MIT License
I'm new to svelte, try to make an element explode on exit.
How do I use this in on:out?
Hi,
Though the README for @neoconfetti/react
reads "Works seamlessly in NextJS/Remix/Gatsby/Redwood and other Server Side Rendering environments!"
Adding the Confetti import to a Server Side Rendered page provides the error:
node_modules/@neoconfetti/react/dist/index.js (211:28) @ Confetti
useRef only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/react-client-hook-in-server-component
In most cases it's possible to just add "use client", but in apps that need to also be defining page metadata it becomes impossible to use this library and set things like the page title/opengraph data.
For example,
import { Confetti } from '@neoconfetti/react';
import { Metadata } from "next";
const metadata: Metadata = {
title: "Happy Page!",
}
function HappyPage() {
return (
<div>
<Confetti/>
</div>
)
}
export default HappyPage;
export { metadata };
You're forced to choose between Confetti
(client component) and metadata
(server component)
This is with [email protected]
and @neoconfetti/[email protected]
Hi Puru,
Nice library and amazing work as usual
I didn't know that I needed this library until I played with the svelte REPL. I don't quite understand how the particles are generated, but reading through the code I see that you limited to a few shapes for particles.
My question, is if I wanted to changed the particle to be one or more images where should I start? Essentially the confettis would be images. I feel that this option will negatively affect performance should the user go a bit too crazy with the images
Thank you for reading,
Currently, it is https://www.npmjs.com/package/svelte-confetti-explosion when it should be https://www.npmjs.com/package/@neoconfetti/svelte:
Add an onComplete property. Vanilla should still support this as well as explode: Promise
I tried to use it with "use client" but didn't work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.