Memoize routes and named routes
namedRoutes are recalculated every render, but their values only change if
children change, which—on the fly—it never does.
namedRoutes in React 's
useMemo hook removes the hassle of recalculating these two values every render.
NOTE: The way
namedRoutes is defined, it technically does remember if it was called since it closes over a boolean that it sets, but this is maybe a more React-ish way of doing it?