Skip to content

fix: time ago refresh#15

Open
amper-fb wants to merge 1 commit intomainfrom
time_ago
Open

fix: time ago refresh#15
amper-fb wants to merge 1 commit intomainfrom
time_ago

Conversation

@amper-fb
Copy link
Copy Markdown
Contributor

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

No description provided.

};
}, []);

// update "time ago" every 5 secs
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

2 participants