Delete layer before creating a new one with react-leaflet-draw in leaflet

My purpose here is to allow only one polygon on the map. My approach has been saving the new layer during onCreated method in a var or array and in the method onDrawStart get it and delete, so once the user tries to draw another shape, the previous one gets removed, but this is not working, any suggestion how to make it possible?