message: Convert Link to hooks
diff: -import React from 'react';
  +import React, { useEffect, useState } from 'react';
  import styles from './Link.m.scss';
  import { DestinyAccount } from '../accounts/destiny-account';
  import { UISrefActive, UISref } from '@uirouter/react';
  import { router } from '../router';
  -interface Props {
  +export default function Link({
  + state,
  + account,
  + children,
  + text,
  + showWhatsNew
  +}: {
  account?: DestinyAccount;
  state: string;
  text?: string;
  children?: React.ReactChild;
  showWhatsNew?: boolean;
  -}
  -
  -interface State {
  - generation: number;
  -}
  -
  -export default class Link extends React.Component<Props, State> {
  - // tslint:disable-next-line:ban-types
  - private unregisterTransitionHooks: Function[] = [];
  -
  - constructor(props) {
  - super(props);
  - this.state = {
  - generation: 0
  - };
  - }
  -
  - componentDidMount() {
  - this.unregisterTransitionHooks = [
  - router.stateRegistry.onStatesChanged(() => {
  - this.setState((state) => ({ generation: state.generation + 1 }));
  - })
  - ];
  - }
  -
  - componentWillUnmount() {
  - this.unregisterTransitionHooks.forEach((f) => f());
  - }
  -
  - render() {
  - const { state, account, children, text, showWhatsNew } = this.props;
  -
  +}) {
  // This should be a really simple component, but because of https://github.com/ui-router/react/issues/204
  // it can't handle lazy states, and we need to use "key" to nuke the whole component tree on updates.
  + const [generation, setGeneration] = useState(0);
  + useEffect(() => router.stateRegistry.onStatesChanged(() => setGeneration((g) => g + 1)), []);
  return (
  - <UISrefActive key={this.state.generation} class="active">
  + <UISrefActive key={generation} class="active">
  <UISref to={state} params={account}>
  <a className="link">
  {showWhatsNew && <span className={styles.badgeNew} />}
  @@ -57,4 +34,3 @@ export default class Link extends React.Component<Props, State> {
  </UISrefActive>
  );
  }
  -}
  