Using url query strings with "layout" variable instead of function

After registering a page, you can use the layout() function to capture url query parameters, e.g., def layout(var1=None): to capture the var1 query parameter.

In general, you can either define a layout() function or a layout variable to define a page layout. Is there any way to do the above but while using the layout variable instead of the function?

dcc.Location() seems to be the only way