Skip to content

Responsive object not working in options object #111

Closed Answered by SajawalHassan
SajawalHassan asked this question in Q&A
Discussion options

You must be logged in to vote

I've found a workaround for now which is simply render two different components using javascript / typescript. Instead of using css to display none on the components (which doesn't work for some reason) I am rendering two entirely different components based on the window.innerWidth. Thought this might help!

"use client";

import { useEffect, useState } from "react";
import Particles, { initParticlesEngine } from "@tsparticles/react";
import { IOptions, RecursivePartial, type Container, type ISourceOptions } from "@tsparticles/engine";
import { loadSlim } from "@tsparticles/slim";
// import { loadFull } from "tsparticles";
import { cn } from "@/lib/utils";

interface Props {
  optionsMobil…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by SajawalHassan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant