Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form/project #25

Merged
merged 15 commits into from
Jun 14, 2021
Merged

Form/project #25

merged 15 commits into from
Jun 14, 2021

Conversation

ThomasBarrial
Copy link
Contributor

No description provided.

src/API/requests.js Outdated Show resolved Hide resolved
Comment on lines 12 to 15
const [firstname, setFirstname] = useState<string>("");
const [lastname, setLastName] = useState<string>("");
const [email, setEmail] = useState<string>("");
const [profession, setProfession] = useState<string>("");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace useState<string>("") with useState("")

As you pass a string as default value, the type is infered
https://www.carlrippon.com/typed-usestate-with-typescript/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at some point typescript complained about the type of the state being never

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the case if you don't give a default value iirc

@@ -0,0 +1,19 @@
import React from "react";
import { HashRouter as Router, Switch } from "react-router-dom";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer using BrowserRouter

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it best to use HashRouter because of the 404 errors that happen if we don't have a server for the redirection?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this issue has been resolved :)

vitejs/vite#3239

.env Outdated
@@ -0,0 +1 @@
VITE_API_URL=http://localhost:5000/api/v1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.env should be gitignored

package.json Outdated
@@ -8,6 +8,7 @@
},
"dependencies": {
"axios": "^0.21.1",
"dotenv": "^10.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to include this dependency

@Karnak19
Copy link
Contributor

Even if you placed .env in your .gitignore, it is still in the git tree.

git rm --cached .env and then re-commit

@Karnak19 Karnak19 merged commit eff93a9 into dev Jun 14, 2021
@Karnak19 Karnak19 deleted the form/project branch June 14, 2021 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants