Answer the question
In order to leave comments, you need to log in
The tag fires faster than the condition in the react component, how to fix it?
React component:
export default function Downloading(props) {
return (
<>
{
props.isDownload
? <>{props.children}</>
: <div>Загрузка...</div>
}
</>
)
}
<Downloading isDownload={isDownload}>
<img src={`http://openweathermap.org/img/wn/${data.current.weather[0].icon}@4x.png`} alt="Weather" />
</Downloading>
Answer the question
In order to leave comments, you need to log in
Something like that
export default function Downloading(props) {
return (
<>
{
props.isDownload
? <>{props.children()}</>
: <div>Загрузка...</div>
}
</>
)
}
<Downloading isDownload={isDownload}>
{() => <img src={`http://openweathermap.org/img/wn/${data.current.weather[0].icon}@4x.png`} alt="Weather" />}
</Downloading>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question