How are you. This is scenario of this issue. Let's say there are 2 screens to make it simple.
navigate back to A screen from B. at this time, useEffect is not called.
function CompanyComponent(props) {
const [roleID, setRoleID] = useState(props.user.SELECTED_ROLE.id)
useEffect(()=>{
// this called only once when A screen(this component) loaded,
// but when comeback to this screen, it doesn't called
setRoleID(props.user.SELECTED_ROLE.id)
}, [props.user]) …Run Code Online (Sandbox Code Playgroud)