[英]I am new in react i want to convert normal javascript code to the react i don't know how to do that
this is my react java script where i want to insert the normal js code.这是我的 react java 脚本,我想在其中插入普通的 js 代码。 I have tried by using the {} brackets but that won't run.我已尝试使用 {} 括号,但无法运行。
import './App.css';
function App() {
return (
<>
<div className="container"></div><div className="box">
<div className="wrapper">
<div className="form-wrapper sign-in">
<form action="">
<h2 className="he">Login</h2>
<div className="input-group">
<input className="ip1" type="text" required/>
<label for="">Username</label>
<i></i>
</div>
<div className="input-group">
<input type="password" required/>
<label for="">Password</label>
<i></i>
</div>
<button type="submit">Login</button>
<div className="signUp-link">
<p className="p1">Don't have an account? <a href="#" className="signUpBtn-link">Sign Up</a></p>
</div>
</form>
</div>
<div className="form-wrapper sign-up">
<form action="">
<h2 className="he2">Sign Up</h2>
<div className="input-group">
<input type="text" required/>
<label for="">Username</label>
<i></i>
</div>
<div className="input-group">
<input type="text" required/>
<label for="">Email</label>
<i></i>
<button type="submit">Sign Up</button>
<div className="signUp-link">
<p>Already have an account? <a href="#" className="signInBtn-link">Sign In</a></p>
</div>
</form>
</div>
</div>
</div></>
);
}
export default App;
This is the code that i wanto to merge.这是我想合并的代码。 I Want to merge the following code in the above code.我想在上面的代码中合并以下代码。 I have a normal javaScript code but i don't know how to write it in the React我有一个正常的 javaScript 代码,但我不知道如何在 React 中编写它
const signInBtnLink = document.querySelector('.signInBtn-link');
const signUpBtnLink = document.querySelector('.signUpBtn-link');
const wrapper = document.querySelector('.wrapper');
signUpBtnLink.addEventListener('click', () => {
wrapper.classList.toggle('active');
});
signInBtnLink.addEventListener('click', () => {
wrapper.classList.toggle('active');
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.