react native 总结

 react  app.js 相当与vue app.vue

import React from 'react';
import './App.css';
import ReactRoute from  './router'
import {HashRouter as Router,Link} from 'react-router-dom'
class  App extends React.Component {
    constructor(props){
        super(props)
    }
    render(){
         return ( 
RouterA
RouterB



); } } export default App;

 相当于vue 的index.js

import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
ReactDOM.render( <
    React.StrictMode >
        
    ,
    document.getElementById("root")
);

 react 中定义路由

import { HashRouter as Router, Route, Switch} from 'react-router-dom';
import React from 'react';
import RouterA from './RouterA';
import RouterB from './RouterB';
export default function ReactRoute() {
    return ( 
); }

 react 中定义组件

import React from "react";
import ReactDOM from "react-dom";
class RouterA  extends React.Component {
    render(){
            return 

RouterA < /h1>

; } } export default RouterA;

你可能感兴趣的:(react,native,react.js,javascript)