Reactjs – Is there a way to set const value which can change due to its dependencies?
I am trying to set a const value using useState hook: const [liked, setLiked] = useState(messages?.likes?.some((like)=>like.id === user.id)) Here, when messages change, liked value doesn't update. I know I can use useEffect hook, but is there a way to define…