history push

This commit is contained in:
Primakov Alexandr Alexandrovich 2024-10-24 18:59:32 +03:00
parent 008c2d3cb7
commit c28721b1f4

View File

@ -1,17 +1,25 @@
import React from "react"; import React from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { getHistory } from '@brojs/cli'
import { URLs } from "../../__data__/urls";
import { getNavigationsValue } from "@brojs/cli"; import { getNavigationsValue } from "@brojs/cli";
import { URLs } from "../../__data__/urls";
const history = getHistory();
export const ProfilePage = () => { export const ProfilePage = () => {
const handletoNav2Click = (event) => {
event.preventDefault()
history.push(getNavigationsValue('nav2.main'));
}
return ( return (
<div> <div>
<h1>profile page</h1> <h1>profile page</h1>
<Link to={URLs.about.getUrl()}>go to about page</Link> <Link to={URLs.about.getUrl()}>go to about page</Link>
<div> <div>
<a href={getNavigationsValue('nav2.main')}>edit profile</a> <a onClick={handletoNav2Click} href={getNavigationsValue('nav2.main')}>edit profile</a>
</div> </div>
</div> </div>
); );