Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marquee not change loop children when children is input and change value of input #287

Open
truongnc1 opened this issue May 11, 2024 · 6 comments

Comments

@truongnc1
Copy link

No description provided.

@truongnc1 truongnc1 changed the title marquee not change loop children when children is input and change value of input Marquee not change loop children when children is input and change value of input May 11, 2024
@tjenkinson
Copy link
Owner

Sorry not really following. Would be great if you could provide an example on stackblitz? Could fork https://stackblitz.com/github/tjenkinson/dynamic-marquee/tree/master/demo?title=Dynamic%20Marquee%20Demo&file=src%2Fmain.ts

@truongnc1
Copy link
Author

with code: import * as React from 'react';
import { Marquee } from 'dynamic-marquee-react';

import './style.css';

export default function App() {
const [counter, setCounter] = React.useState(0);
const [items, setItems] = React.useState([1]);

React.useEffect(() => {
const timer = setInterval(() => setCounter((a) => a + 1), 1000);
return () => clearInterval(timer);
}, []);

return (


<div onClick={() => setItems((pre) => pre.concat(1))}>Button


{items.map((item, index) => (
{index}

))}


);
}

item incorrect loop: 1 2 1 2 1 2. Please check for me!

@tjenkinson tjenkinson transferred this issue from tjenkinson/dynamic-marquee May 12, 2024
@tjenkinson
Copy link
Owner

tjenkinson commented May 12, 2024

Hi @truongnc1

I am not sure what you are trying to do. The code doesn't actually run at all, as you can see here: https://stackblitz.com/edit/github-qnyo2f?file=src%2Fapp.tsx

@tjenkinson
Copy link
Owner

If you are able to share an example that shows your issue then I can help

@truongnc1
Copy link
Author

this code not return: 1 2 1 2 1 2. with rate = 0?

@tjenkinson
Copy link
Owner

The code you send doesn't run are you running something different?

But your problem might be that in the loop you're returning the index not the item

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants