📅  最后修改于: 2022-03-11 14:58:19.783000             🧑  作者: Mango
// import React, {Component, Props, ReactDOM} from 'react';
// import {Route, Switch} from 'react-router'; etc etc
// this snippet has it all attached to window since its in browser
const {
BrowserRouter,
Switch,
Route,
Link,
NavLink
} = ReactRouterDOM;
class World extends React.Component {
constructor(props) {
super(props);
console.dir(props);
this.state = {
fromIdeas: props.match.params.WORLD || 'unknown'
}
}
render() {
const { match, location} = this.props;
return (
{this.state.fromIdeas}
thing:
{location.query
&& location.query.thing}
another1:
{location.query
&& location.query.another1
|| 'none for 2 or 3'}
);
}
}
class Ideas extends React.Component {
constructor(props) {
super(props);
console.dir(props);
this.state = {
fromAppItem: props.location.item,
fromAppId: props.location.id,
nextPage: 'world1',
showWorld2: false
}
}
render() {
return (
item: {this.state.fromAppItem.okay}
id: {this.state.fromAppId}
Home 1
{this.state.showWorld2
&&
Home 2
}
Home 3
);
}
}
class App extends React.Component {
render() {
return (
Ideas
);
}
}
ReactDOM.render((
), document.getElementById('ideas'));