braposo / react-text-loop

Animate words in your headings

Home Page:https://codesandbox.io/s/react-text-loop-playground-br4q1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

jun747093801 opened this issue · 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]);
},[])

{numsList.map((item: any, index: number) => {
return (

{item}

)
})}

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

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.

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