For most synchronization tasks that do not require pre-paint layout work, useEffect is the better default.