I am new to react js. Here, I have following components where it is not getting called.
export const BG: React.FunctionComponent<Icard> = ({ const state = useLocalStore(() => ({ id = url setId(url) { state.id = url } })) const changeImage = () =? { } React.useEffect(() => { state.setId(id) }, [id]) const bgWrapper = ( <div className={classNames({ [css.ImageContainer]: true, [css.defaultImage]: !state.imageURI })}> {isUploadMode ? ( <upload imageUrl={state.imageURI} changeImage={changeImage} ) : ( <BImage image={defaulImage} /> )} </div> ) return useObserver(() => ( <div className={css.BgCard}> {isUploadMode ? ( bgWrapper ) : ( <p>Hello</p> )} </div> )) }) Now here useEffect is not getting called . Now if I use this without creating a jsx vaiable. and use that div directly then it works. Can any one help me why the useEffect is not getting called .
iddefined?id? You aren't defining it anywhere.idinstate. I think OP should not touch Mobx until he is more comfortable with the basic react hooks. See suggestion.