How to change Image on button click in a prefab that is instantiated

I am wanting to change a UI image that is a part of a prefab that I am instantiating in a 3D world by clicking different buttons in the UI.

I don’t want to make a bunch of prefabs where the only thing that is changing is the image. It would be ideal if it changed the image component of the prefab so when I wanted to swap the image it would only change the ones that are instantiated after the change.

Does this make sense?

All input would be very helpful! Thank you in advance.

Hi, I don’t know if this is exactly what you mean and need but hope it would help.

public Button button;
public Sprite newImage;

    void Start()
    {
        button = GetComponent<Button>();
    }

    public void ChangeImage()
    {
        button.GetComponent<Image>().sprite = newImage;
    }