File size: 444 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { isSpecialClick } from '../core/utils';

export default class Link extends Component {
  static propTypes = {
    onClick: PropTypes.func.isRequired,
  };

  onClick = (e) => {
    if (isSpecialClick(e)) {
      return;
    }
    this.props.onClick();
    e.preventDefault();
  };

  render() {
    return <a {...this.props} onClick={this.onClick} />;
  }
}