Skip to content

Commit a947936

Browse files
committed
chore(frontend): import from React Router instead of Reach Router
1 parent 73298b5 commit a947936

File tree

6 files changed

+13
-14
lines changed

6 files changed

+13
-14
lines changed

packages/frontend/src/content/CreateNote.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React, { useState, FormEvent } from "react";
22
import { Form, Button, Alert } from "react-bootstrap";
3-
import { navigate, RouteComponentProps } from "@reach/router";
3+
import { useNavigate } from "react-router-dom";
44
import { GATEWAY_URL, MAX_FILE_SIZE } from "../config.json";
55
import { putObject } from "../libs";
66
import { HomeButton, ButtonSpinner, PageContainer } from "../components";
77
import { RecordAudioButton } from "./RecordAudioButton";
88
import { PlayAudioButton } from "./PlayAudioButton";
99

10-
const CreateNote = (props: RouteComponentProps) => {
10+
const CreateNote = (props: any) => {
1111
const [isLoading, setIsLoading] = useState(false);
1212
const [errorMsg, setErrorMsg] = useState("");
1313
const [noteContent, setNoteContent] = useState("");
@@ -36,7 +36,7 @@ const CreateNote = (props: RouteComponentProps) => {
3636
method: "POST",
3737
body: JSON.stringify({ attachment, content: noteContent }),
3838
});
39-
navigate("/");
39+
useNavigate()("/");
4040
} catch (error) {
4141
setErrorMsg(`${error.toString()} - ${createNoteURL} - ${noteContent}`);
4242
} finally {

packages/frontend/src/content/DeleteNoteButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState } from "react";
22
import { Button, Alert } from "react-bootstrap";
33
import { GATEWAY_URL } from "../config.json";
4-
import { navigate } from "@reach/router";
4+
import { useNavigate } from "react-router-dom";
55
import { deleteObject } from "../libs";
66
import { ButtonSpinner } from "../components";
77

@@ -23,7 +23,7 @@ const DeleteNoteButton = (props: { noteId: string; attachment?: string }) => {
2323
await fetch(deleteNoteURL, {
2424
method: "DELETE",
2525
});
26-
navigate("/");
26+
useNavigate()("/");
2727
} catch (error) {
2828
setErrorMsg(`${error.toString()} - ${deleteNoteURL} - ${noteId}`);
2929
} finally {

packages/frontend/src/content/ListNotes.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useEffect } from "react";
2-
import { Link, RouteComponentProps } from "@reach/router";
2+
import { Link } from "react-router-dom";
33
import { GATEWAY_URL } from "../config.json";
44
import { Card, Alert, CardColumns, Button } from "react-bootstrap";
55
import { Loading, PageContainer } from "../components";
@@ -10,7 +10,7 @@ interface Note {
1010
attachment: boolean;
1111
}
1212

13-
const ListNotes = (props: RouteComponentProps) => {
13+
const ListNotes = (props: any) => {
1414
const [isLoading, setIsLoading] = useState(true);
1515
const [errorMsg, setErrorMsg] = useState("");
1616
const [notes, setNotes] = useState([]);

packages/frontend/src/content/NotFound.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import React from "react";
2-
import { RouteComponentProps } from "@reach/router";
32
import { HomeButton, PageContainer } from "../components";
43

5-
const NotFound = (props: RouteComponentProps) => (
4+
const NotFound = (props: any) => (
65
<PageContainer header={<HomeButton />}>404 Page Not Found</PageContainer>
76
);
87

packages/frontend/src/content/SaveNoteButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState } from "react";
22
import { Button, Alert } from "react-bootstrap";
33
import { GATEWAY_URL } from "../config.json";
4-
import { navigate } from "@reach/router";
4+
import { useNavigate } from "react-router-dom";
55
import { ButtonSpinner } from "../components";
66

77
const SaveNoteButton = (props: { noteId: string; noteContent: string }) => {
@@ -20,7 +20,7 @@ const SaveNoteButton = (props: { noteId: string; noteContent: string }) => {
2020
method: "PUT",
2121
body: JSON.stringify({ content: noteContent }),
2222
});
23-
navigate("/");
23+
useNavigate()("/");
2424
} catch (error) {
2525
console.log(error);
2626
setErrorMsg(`${error.toString()} - ${updateNoteURL} - ${noteContent}`);

packages/frontend/src/content/ShowNote.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React, { useState, useEffect } from "react";
2-
import { RouteComponentProps, navigate } from "@reach/router";
2+
import { useNavigate } from "react-router-dom";
33
import { Form, Card } from "react-bootstrap";
44
import { GATEWAY_URL } from "../config.json";
55
import { DeleteNoteButton, SaveNoteButton } from "./";
66
import { getObjectUrl } from "../libs";
77
import { HomeButton, Loading, PageContainer } from "../components";
88

9-
const ShowNote = (props: RouteComponentProps<{ noteId: string }>) => {
9+
const ShowNote = (props: any) => {
1010
const { noteId } = props;
1111
const [isLoading, setIsLoading] = useState(true);
1212
const [noteContent, setNoteContent] = useState("");
@@ -28,7 +28,7 @@ const ShowNote = (props: RouteComponentProps<{ noteId: string }>) => {
2828
}
2929
} catch (error) {
3030
// Navigate to 404 page, as noteId probably not present
31-
navigate("/404");
31+
useNavigate()("/404");
3232
} finally {
3333
setIsLoading(false);
3434
}

0 commit comments

Comments
 (0)