react-torch
Version:
A lib to server-side render with react.
19 lines (18 loc) • 782 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Link = void 0;
var react_1 = __importDefault(require("react"));
var hook_1 = require("../hook");
var Link = function (_a) {
var href = _a.href, children = _a.children, style = _a.style, className = _a.className, onClick = _a.onClick;
var history = (0, hook_1.useHistory)();
var handleClick = function (event) {
history.push(href);
event.preventDefault();
};
return (react_1.default.createElement("a", { className: className, href: href, onClick: onClick || handleClick, style: style }, children));
};
exports.Link = Link;