简体   繁体   English

我是 React 的新手,我想将普通的 javascript 代码转换为 React,我不知道该怎么做

[英]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');
});

Welcome to the world of react js,!, start your leanings here react js欢迎来到 React js 的世界!,从这里开始学习 React js

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 大家好,我是 jQuery 的新手,有人问我这个问题,但我不知道该怎么做 - Hi everyone , I am new to jQuery and I was asked this question but I don't know how to do it 我想用反应在 fullpage.js 中添加 class 'active',但我不知道如何 - I want to add the class 'active' in fullpage.js with react, and I don't know how 我如何知道我是否在 React 路由器中? - How do I know if I am inside a React router? 我不想在javascript上重复相同的代码**新** - I don't want to repeat the same code on javascript **new ** 如果我不拥有该代码,如何将 Ref 分配给 React 组件中的按钮? 我想集中注意力 - How to assign a Ref to a button in a React component if I don't own that code? I want to focus it 我知道我想要什么,但我不知道该怎么做! (chrome扩展名) - I know what I want, but I don't know how to do it! (chrome extension) if/else 语句似乎在 Javascript 中不起作用,我不知道我做错了什么 - If/else statements just do not seem to be working in Javascript and i don't know what I am doing wrong 我不知道为什么我得到这个,如果它是根据 React 手册 - I don't know why I get this, if it is according to the React manual 我想为HTML5画布编写Javascript,但是我不知道如何设置画布 - I want to write Javascript for an HTML5 canvas, but I don't know how to set the canvas up 我想以一种非常具体的方式修改 Javascript 中的数组,但我不知道如何 - I want to modify an array in Javascript in a very specific way and i don't know how to
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM