useNavigate
A hook to navigate programmatically.
import { useNavigate } from 'react-sprout';
let [navigate, busy, loading, navigations] = useNavigate();
- Name
- navigate
- Type
- function
- Description
- A function to navigate programmatically. 
 
- Name
- busy
- Type
- boolean
- Description
- A boolean indicating whether navigations are currently busy. 
 
- Name
- loading
- Type
- boolean
- Description
- A boolean indicating whether navigations are currently loading. 
 
- Name
- navigations
- Type
- Array
- Description
- An array of busy navigations. 
 
Navigate
navigate(options);
navigate(to, options);
- Name
- to
- Type
- string
- Description
- The target url of the navigation 
 
- Name
- options
- Type
- object
- Description
- The navigation options 
 
Navigate options
- Name
- options.relative
- Type
- boolean
- Type
- true
- Description
- A boolean indicating whether the target url is relative to the route. 
 
- Name
- options.method
- Type
- string
- Type
- GET
- Description
- A string indicating the type of the navigation. 
 
- Name
- options.data
- Type
- any
- Description
- The data associated with the navigation 
 
- Name
- options.push
- Type
- boolean
- Description
- A boolean indicating whether a new entry in the history stack should be pushed. 
 
- Name
- options.replace
- Type
- boolean
- Description
- A boolean indicating whether the current entry in the history stack should be replaced. 
 
- Name
- options.title
- Type
- string
- Description
- The document title after navigation. 
 
- Name
- options.state
- Type
- any
- Description
- The history state after navigation. 
 
- Name
- options.sticky
- Type
- boolean
- Type
- false
- Description
- A boolean indicating whether the navigation is sticky. 
 
- Name
- options.reload
- Type
- boolean
- Type
- false
- Description
- A boolean indicating whether to reload all data for the navigation. 
 
- Name
- options.cache
- Type
- boolean
- Type
- false
- Description
- A boolean indicating whether the current page should be kept in the back/forward cache. 
 
- Name
- options.onNavigate
- Type
- function
- Description
- A callback that is invoked when a navigation is initiated. 
 
- Name
- options.onCanceled
- Type
- function
- Description
- A callback that is invoked when a navigation is canceled. 
 
- Name
- options.onNavigateStart
- Type
- function
- Description
- A callback that is invoked when a navigation is not canceled. 
 
- Name
- options.onActionError
- Type
- function
- Description
- A callback that is invoked when a navigation action throws an error. 
 
- Name
- options.onAborted
- Type
- function
- Description
- A callback that is invoked when a navigation is aborted. 
 
- Name
- options.onNavigateEnd
- Type
- function
- Description
- A callback that is invoked when a navigation is finished. 
 
