Open
Conversation
Gary-Distinctioncoding
left a comment
There was a problem hiding this comment.
there is a major logic issue when submitting the form, as well as the layout for the whole react app
There was a problem hiding this comment.
remove the git track of this file, this file should not be commited
| @@ -0,0 +1,15 @@ | |||
| import bgImage from '../Component/bgi.png'; | |||
There was a problem hiding this comment.
static file should be put in public folder
Comment on lines
+11
to
+13
| <App /> | ||
| <BackGround /> | ||
| <SignIn /> |
There was a problem hiding this comment.
this layout will cause all the pages use the background image, consider to put background image wrapped in signin component only.
App component 通常作为应用的根组件
function App() {
return (
<div>
<Header />
<MainContent />
<Footer />
</div>
);
}
Comment on lines
+11
to
+12
| const [phoneError, setPhoneError] = useState(""); | ||
| const [passwordError, setPasswordError] = useState(""); |
Comment on lines
+18
to
+28
| if (!phoneNumber) { | ||
| setPhoneError("Phone number is required."); | ||
| } else if (!/^\+?[1-9]\d{1,14}$/.test(phoneNumber)) { | ||
| setPhoneError("Please enter a valid phone number."); | ||
| } | ||
|
|
||
| if (!password) { | ||
| setPasswordError("Password is required."); | ||
| } else if (password.length < 6) { | ||
| setPasswordError("Password must be at least 6 characters long."); | ||
| } |
There was a problem hiding this comment.
验证不通过还是会发送http请求,需要return中断这个function
可以考虑把表单验证单独提取出一个function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.