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

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

Open
jun747093801 opened this issue Jul 21, 2020 · 3 comments
Open

Comments

@jun747093801
Copy link

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}

)
})}

@himadrinath
Copy link

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

@braposo
Copy link
Owner

braposo commented Aug 25, 2020

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.

@himadrinath
Copy link

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

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

3 participants