GTK4 - Render a widget and all its children into buffer

I have an application with a hierarchy of widgets contained in a Gtk::ApplicationWindow. Inside the window is a child Gtk::Grid, and inside it various widgets such as buttons and boxes.
I would like the ability to take a snapshot of everything either every frame or whenever something changes.
How should I approach this?