Shopping cart combined with single page Web application

Source: Internet
Author: User

In Reg.js

Import React, {Component} from "React"class Reg extends component{render () {return(            <div> <ul> <li><label> user name: </label><input/&GT;&LT;/LI&G                    T <li><label> Password: </label><input/></li> <li><label> Email: </label                    ><input/></li> <li><label> Mobile: </label><input/></li> <li><button> Registration </button></li> <li><button onclick={ This. Tologin.bind ( This)}> to login </button></li> </ul> </div>        )    }    //ControllerTologin () { This. Props.history.push ("/login")}}exportdefaultReg;

In the Login.js file

Import React, {Component} from "React"Import {Link} from' React-router-dom '; class Login extends component{render () {return(            <div> <ul> <li><label> user name: </label><input/&GT;&LT;/LI&G                    T <li><label> Password: </label><input/></li> <li><button onclick={ This. Tomain.bind ( This)}> login </button></li> <li><link to= "/reg" > Go to Registration </Link></li>                    {/*<li><button Onclick={this.toreg.bind (this)}> go to register </button></li>*/}                </ul> </div>        )    }    //ControllerTomain () { This. Props.history.push ("/main")} toreg () { This. Props.history.push ("/reg")}}exportdefaultLogin;

In Main.js

Import React, {Component} from "React"Import Quest from'./quest/stwo 'Import Goods from'./shop/shopt '; import {Hashrouter as Router, Route,link} from' React-router-dom '; class Main extends component{render () {return(            <div> <div> <ul> <li><link to= "/main/a                    1 "> Full minus </Link></li> <li><link to="/MAIN/A2 "> 50 percent </Link></li>                        </ul> </div> <Router> <div> <route path= '/main/a1 ' component={quest}/> <route path= '/main/a2 ' compo Nent={goods}/> </div> </Router> </div>)}}exportdefaultMain;

In Index.js

Import React from ' React 'react-dom'./main './reg './login '; import {    Hashrouter as Router,    ' react-router-dom '; // Login Registration Reactdom.render (    <Router>        <div>            <route path= '/reg ' Component={reg}/ >            <route path= '/login ' Component={login}/>            <route path= '/main ' Component={main}/>        </div>    </Router>), document.getElementById (' root ');

Shopping cart combined with single page Web application

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.