diff --git a/exercises/04.router/01.problem.router/ui/router.js b/exercises/04.router/01.problem.router/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/04.router/01.problem.router/ui/router.js +++ b/exercises/04.router/01.problem.router/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/04.router/01.solution.router/ui/router.js b/exercises/04.router/01.solution.router/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/04.router/01.solution.router/ui/router.js +++ b/exercises/04.router/01.solution.router/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/04.router/02.problem.pending-ui/ui/router.js b/exercises/04.router/02.problem.pending-ui/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/04.router/02.problem.pending-ui/ui/router.js +++ b/exercises/04.router/02.problem.pending-ui/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/04.router/02.solution.pending-ui/ui/router.js b/exercises/04.router/02.solution.pending-ui/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/04.router/02.solution.pending-ui/ui/router.js +++ b/exercises/04.router/02.solution.pending-ui/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/04.router/03.problem.race-conditions/ui/router.js b/exercises/04.router/03.problem.race-conditions/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/04.router/03.problem.race-conditions/ui/router.js +++ b/exercises/04.router/03.problem.race-conditions/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/04.router/03.solution.race-conditions/ui/router.js b/exercises/04.router/03.solution.race-conditions/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/04.router/03.solution.race-conditions/ui/router.js +++ b/exercises/04.router/03.solution.race-conditions/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/04.router/04.problem.history/ui/router.js b/exercises/04.router/04.problem.history/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/04.router/04.problem.history/ui/router.js +++ b/exercises/04.router/04.problem.history/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/04.router/04.solution.history/ui/router.js b/exercises/04.router/04.solution.history/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/04.router/04.solution.history/ui/router.js +++ b/exercises/04.router/04.solution.history/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/04.router/05.problem.cache/ui/router.js b/exercises/04.router/05.problem.cache/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/04.router/05.problem.cache/ui/router.js +++ b/exercises/04.router/05.problem.cache/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/04.router/05.solution.cache/ui/router.js b/exercises/04.router/05.solution.cache/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/04.router/05.solution.cache/ui/router.js +++ b/exercises/04.router/05.solution.cache/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/05.actions/01.problem.action-reference/ui/router.js b/exercises/05.actions/01.problem.action-reference/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/05.actions/01.problem.action-reference/ui/router.js +++ b/exercises/05.actions/01.problem.action-reference/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/05.actions/01.solution.action-reference/ui/router.js b/exercises/05.actions/01.solution.action-reference/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/05.actions/01.solution.action-reference/ui/router.js +++ b/exercises/05.actions/01.solution.action-reference/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/05.actions/01.solution.action-reference/ui/ship-search.js b/exercises/05.actions/01.solution.action-reference/ui/ship-search.js index 5995bf7..53a25d3 100644 --- a/exercises/05.actions/01.solution.action-reference/ui/ship-search.js +++ b/exercises/05.actions/01.solution.action-reference/ui/ship-search.js @@ -46,24 +46,11 @@ export function ShipSearch({ search, results, fallback }) { } export function SelectShipLink({ shipId, highlight, children }) { - const { location, navigate } = useRouter() + const { location } = useRouter() return h('a', { children, - href: `/${shipId}`, + href: mergeLocationState(location, { shipId }), style: { fontWeight: highlight ? 'bold' : 'normal' }, - onClick: event => { - if ( - event.ctrlKey || - event.metaKey || - event.shiftKey || - event.button !== 0 - ) { - return - } - event.preventDefault() - const newLocation = mergeLocationState(location, { shipId }) - navigate(newLocation) - }, }) } diff --git a/exercises/05.actions/02.problem.client/ui/router.js b/exercises/05.actions/02.problem.client/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/05.actions/02.problem.client/ui/router.js +++ b/exercises/05.actions/02.problem.client/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/05.actions/02.solution.client/ui/router.js b/exercises/05.actions/02.solution.client/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/05.actions/02.solution.client/ui/router.js +++ b/exercises/05.actions/02.solution.client/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/05.actions/03.problem.server/ui/router.js b/exercises/05.actions/03.problem.server/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/05.actions/03.problem.server/ui/router.js +++ b/exercises/05.actions/03.problem.server/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/05.actions/03.solution.server/ui/router.js b/exercises/05.actions/03.solution.server/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/05.actions/03.solution.server/ui/router.js +++ b/exercises/05.actions/03.solution.server/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/05.actions/04.problem.revalidation/ui/router.js b/exercises/05.actions/04.problem.revalidation/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/05.actions/04.problem.revalidation/ui/router.js +++ b/exercises/05.actions/04.problem.revalidation/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/05.actions/04.solution.revalidation/ui/router.js b/exercises/05.actions/04.solution.revalidation/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/05.actions/04.solution.revalidation/ui/router.js +++ b/exercises/05.actions/04.solution.revalidation/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/05.actions/05.problem.history-revalidation/ui/router.js b/exercises/05.actions/05.problem.history-revalidation/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/05.actions/05.problem.history-revalidation/ui/router.js +++ b/exercises/05.actions/05.problem.history-revalidation/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) { diff --git a/exercises/05.actions/05.solution.history-revalidation/ui/router.js b/exercises/05.actions/05.solution.history-revalidation/ui/router.js index 5350d3e..c3e2ec2 100644 --- a/exercises/05.actions/05.solution.history-revalidation/ui/router.js +++ b/exercises/05.actions/05.solution.history-revalidation/ui/router.js @@ -11,6 +11,7 @@ export function useRouter() { return context } +// Thanks Devon: https://twitter.com/devongovett/status/1672307153699471360 export function useLinkHandler(navigate) { useEffect(() => { function onClick(event) {