(EditorWindow) How to save a reference to a GameObject?

I want to be able to save a reference to a GameObject.

I was told the best way is to save the path of it and then convert it back into a GameObject but unsure on how to go about this.

Can sb help me with this?