A little background: I am learning react since 1 or maybe 2 days, so I don't know the good or bad react patterns yet, but in this case I don't feel like I am doing wrong things.
Here is my little component for a header position
import * as React from "react";
import HeaderPosition from "../interfaces/HeaderPosition";
export default class HeaderPositionComponent extends React.Component<HeaderPosition> {
constructor(props: HeaderPosition) {
super(props);
}
render() {
if(this.props.icon.length > 0) {
return (
<a className="py-2 d-none d-md-inline-block" href={ this.props.href }>
<img src={ this.props.icon } alt="NOT CACHED"/>
{ this.props.name }
</a>
);
}
return (
<a className="py-2 d-none d-md-inline-block" href={ this.props.href }>
{ this.props.name }
</a>
);
}
}
There is that line
<img src={ this.props.icon } alt="NOT CACHED"/>
Every time I refresh the page the first thing I see a "NOT CACHED" text, after that it converts into image.
Keep in mind that the src attribute takes external (https) url, I am not having an image on local disk
How to make the "NOT CACHED" alt text actually cache by web browser so a user won't see it with every reload?
I suspect that it's because I am using just a webpack, not a webpack-dev-server to run the page. I will investigate it now
This is how it looks from network tab in dev tools

My network is very fast
EDIT: It's Ubuntu 18 Firefox that is sooo sloooow, Chromium web browser needs 1ms to load the SVG...
It may be not react fault, well...