react-text-loop icon indicating copy to clipboard operation
react-text-loop copied to clipboard

The content in cannot be changed based on changes in hooks data

Open jun747093801 opened this issue 4 years ago • 3 comments

The content in cannot be changed based on changes in hooks data,such as
const [numsList, setNumsList] = useState([4]); useEffect = (() => { const nums = [1, 2, 3]; setNumsList([...nums]); },[]) <TextLoop mask interval={4000}> {numsList.map((item: any, index: number) => { return (

{item}
) })} </TextLoop>

jun747093801 avatar Jul 21 '20 09:07 jun747093801

looks like its ok its content static but its not useful if your content dynamic

himadrinath avatar Aug 21 '20 06:08 himadrinath

Hey @jun747093801 @himadrinath, I'm not completely sure what you mean.

The example you gave is very similar to the "controlled" example in https://codesandbox.io/s/react-text-loop-playground-br4q1?file=/src/App.tsx

Is that what you were looking for? react-text-loop will update the content if any changes to the props happens, as you'd expect from a React component.

braposo avatar Aug 25 '20 23:08 braposo

If data change then I want to play the effect. Like real time data

himadrinath avatar Aug 26 '20 15:08 himadrinath