Based on the idea shared in the answer from user 95faf8e76605e973, I ended up with the following:
My form component:
<Form key={`upload_${image_type}`}>
<div key={`${image_type}`} className="mb-3">
<Form.File
id={`upload_${image_type}`}
key={`upload_${image_type}`}
label={this.state.upload_image[`${image_type}`]["label"]}
custom
onChange={this.FileUploadHandler.bind(this, image_type)}
/>
</div>
</Form>
The fileUploadHandler function invoked on change:
FileUploadHandler = (image_type, e) => {
if (e.target.files) {
console.log(e.target.files);
let file = e.target.files[0];
if (file) {
let current_state = this.state.upload_image;
current_state[image_type]["label"] = file.name;
current_state[image_type]["file"] = file;
this.setState({ upload_image: current_state });
}
} else {
console.log("Nope");
}
};
The state set in my class component's constructor:
export class PackageInfo extends Component {
constructor(props) {
super(props);
this.state = {
upload_image: {
Wallpaper: { label: "Upload File...", file: "No file selected" },
RotationBanner: { label: "Upload File...", file: "No file selected" },
BootBanner: { label: "Upload File...", file: "No file selected" },
Installer: { label: "Upload File...", file: "No file selected" },
AppPage: { label: "Upload File...", file: "No file selected" },
Featured: { label: "Upload File...", file: "No file selected" },
RotationBanner: { label: "Upload File...", file: "No file selected" },
Logo: { label: "Upload File...", file: "No file selected" },
GameTVBanner: { label: "Upload File...", file: "No file selected" },
GameTiles: { label: "Upload File...", file: "No file selected" },
},
};
}