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 .