-
Notifications
You must be signed in to change notification settings - Fork 4
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
Form/project #25
Conversation
src/components/CreateUserForm.tsx
Outdated
const [firstname, setFirstname] = useState<string>(""); | ||
const [lastname, setLastName] = useState<string>(""); | ||
const [email, setEmail] = useState<string>(""); | ||
const [profession, setProfession] = useState<string>(""); |
There was a problem hiding this comment.
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/
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
src/components/Layout.tsx
Outdated
@@ -0,0 +1,19 @@ | |||
import React from "react"; | |||
import { HashRouter as Router, Switch } from "react-router-dom"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer using BrowserRouter
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 :)
.env
Outdated
@@ -0,0 +1 @@ | |||
VITE_API_URL=http://localhost:5000/api/v1 |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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
Even if you placed
|
No description provided.