Skip to content

Conversation

@amper-fb
Copy link
Contributor

@amper-fb amper-fb commented Nov 7, 2023

No description provided.

};
}, []);

// update "time ago" every 5 secs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this useEffect?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without it, the state doesn't get updated and there's no re-render of the row, maybe it needs to be 1 level outside in the container and not per row?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, so maybe create a TimeAgo component that gets a timestamp and does the useEffect internally. or install https://www.npmjs.com/package/react-time-ago

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

Successfully merging this pull request may close these issues.

3 participants