How to use the @aragon/api-react.usePath function in @aragon/api-react

To help you get started, we’ve selected a few @aragon/api-react examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AutarkLabs / open-enterprise / apps / projects / app / hooks / usePathSegments.js View on Github external
export default function usePathSegments() {
  const [ path, requestPath ] = usePath()
  const [ , selectedTab, selectedIssueId ] = path.match(PATH_REGEX) || []
  const [ , search ] = path.match(SEARCH_REGEX) || []

  const selectIssue = useCallback(issueId => {
    requestPath && requestPath(`/issues/${issueId || ''}`)
  }, [requestPath])

  const query = useMemo(() => {
    if (!search) return {}

    return search.split('&').reduce(
      (acc, param) => {
        const [ , key, value ] = param.match(SEARCH_PARAM_REGEX)
        acc[key] = value
        return acc
      },

@aragon/api-react

Aragon app API for React

AGPL-3.0
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis