在浏览器上使用 react
unpkg material-ui mobx react-router-dom
所有包为开发环境使用
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ajanuw</title>
<script src='https://unpkg.com/react@latest/umd/react.development.js' crossorigin='anonymous'></script>
<script src='https://unpkg.com/react-dom@latest/umd/react-dom.development.js' crossorigin='anonymous'></script>
<script src="https://unpkg.com/react-router-dom@4.3.1/umd/react-router-dom.js"></script>
<script src='https://unpkg.com/@material-ui/core/umd/material-ui.development.js' crossorigin='anonymous'></script>
<script src='https://unpkg.com/babel-standalone@latest/babel.min.js' crossorigin='anonymous'></script>
<script src="https://unpkg.com/mobx@latest/lib/mobx.umd.js"></script>
<script src="https://unpkg.com/mobx-react@latest/index.js"></script>
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Roboto:300,400,500' />
<link rel='stylesheet' href='https://fonts.googleapis.com/icon?family=Material+Icons'>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
const l = console.log
const { Component, Fragment } = React
const { decorate, observable } = mobx
const { observer } = mobxReact
class Store {
name = 'mobx'
}
decorate(Store, {
name: observable,
})
const store = new Store()
class App extends Component {
state = {
name: 'ajanuw'
}
render() {
return (
<div>
{ store.name }
</div>
)
}
componentDidMount(){
setTimeout(() => {
store.name = this.state.name
}, 2000);
}
}
App = observer(App)
const About = () => <div>about</div>
const { HashRouter, BrowserRouter, Route, Switch, withRouter, Redirect } = ReactRouterDOM
ReactDOM.render(
<HashRouter>
<Switch>
<Redirect from='/index.html' to='/' />
<Redirect from='/home' to='/' />
<Route exact struct component={App} path='/' />
<Route exact struct component={About} path='/about' />
</Switch>
</HashRouter>,
document.querySelector('#root')
);
</script>
</body>
</html>
在浏览器上使用 react的更多相关文章
- yii2获取登录前的页面url地址--电脑和微信浏览器上的实现以及yii2相关源码的学习
对于一个有登录限制(权限限制)的网站,用户输入身份验证信息以后,验证成功后跳转到登录前的页面是一项很人性化的功能.那么获取登录前的页面地址就很关键,今天在做一个yii2项目的登录调试时发现了一些很有意 ...
- 在web浏览器上显示室内温度(nodeJs+arduino+socket.io)
上次的nodejs操作arduino入门篇中实现了如何连接arduino.这次我们来实现通过arduino测量室内温度并在浏览器上显示出来. [所需材料] 硬件:LM35温度传感器,arduino u ...
- 解决UC浏览器或微信浏览器上flex兼容问题
在UC浏览器上使用display:flex;时会不起作用,要加上兼容性写法,如下 display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */ disp ...
- 移动端浏览器和微信浏览器上禁止body的滚动条
一般禁止body滚动的做法就是设置overflow:hidden. 但是很奇怪的发现在移动端浏览器和微信浏览器上这个不起作用,然后我分析了我的写法,就是在body上加了一个class去定义属性,然后改 ...
- 后台启动weblogic成功后,在web浏览器上无法访问
后台启动weblogic成功后,在web浏览器上无法访问,可尝试重启服务器.
- 在iis中设置文件下载而不是在浏览器上打开
点击网页链接的*.txt,*.jpg,*.xml等文件时会在浏览器上直接显示,并没有像*.doc那样弹出下载提示框. 解决方法: 在部署的网站上,选择存放文件的目录,选择 HTTP响应标头 ,添加一个 ...
- 1、在MAC上搭建React Native开发环境
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/c ...
- css3在不同型号手机浏览器上的兼容一览表
网上搜集了css3对不同系统手机浏览器的支持情况(ios/android/winphone)备份一下以便查看. 以下资料由微信产品部"白树"整理, 转载请注明. √:完全支持 ...
- 运行QQ出现initialization failure 0x0000000c错误和浏览器上不了网
出现QQ出现initialization failure 0x0000000c错误和浏览器上不了网的问题,原因是关机的时候没有正常关闭导致的. 解决方法: 1.我们在开始菜单栏中的附件中找到“命令提示 ...
随机推荐
- Office365 OneDrive Geo Move
Issue Description: 1. Connect to SPO Service. 2. Validate SPO Service OneDrive Geo move compatibilit ...
- Java程序猿怎样高速理解Kubernetes
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/M2l0ZgSsVc7r69eFdTj/article/details/82892167 https: ...
- Elasticsearch跨集群搜索(Cross Cluster Search)
1.简介 Elasticsearch在5.3版本中引入了Cross Cluster Search(CCS 跨集群搜索)功能,用来替换掉要被废弃的Tribe Node.类似Tribe Node,Cros ...
- (原)ubuntu上编译PANet/Detectron.pytorch时-std=c99的错误
转载请注明出处: https://www.cnblogs.com/darkknightzh/p/10494787.html 在ubuntu上编译PANet/Detectron.pytorch时,总提示 ...
- sql 有条件计数
select InstitutionID=LEFT(InstitutionID,9), Irregularities_Type=sum(CASE WHEN Irregularities_Type> ...
- puppeteer:官方出品的chrome浏览器自动化测试工具
puppeteer发布应该有一段时间了,这两天正好基于该工具写了一些自动化解决方案,在这里抛砖引给大家介绍一下. 官方描述: Puppeteer is a Node library which pro ...
- 使用viewport中的vm来适配移动端页面
前言 作为一个小前端,经常要和H5打交道,这就面临着不同终端的适配问题. Flexible方案通过Hack手段来根据设备的dpr值相应改变<meta>标签中viewport的值,给我更贴切 ...
- Android Glide 源码分析系列(待完成)
参考:https://jekton.github.io/2018/06/08/glide-disk-cache/ 参考:https://jekton.github.io/2018/06/20/glid ...
- Tomcat服务器安装、配置、测试
Tomcat服务器安装.配置.测试(win7_64bit) 目录 1.概述 2.本文用到的工具 3.Tomcat服务器安装配置 4.Tomcat服务器简单测试 5.注意事项 >>看不清的图 ...
- XMind8 破解激活教程(最详细,一定是有效的!!!)
下载安装包 首先去xmind国外官网下载对应操作系统的安装包,国内官网的那个是有残缺的,不支持破解. 点击链接进行下载安装包:https://pan.baidu.com/s/1VITXSEQvwGDi ...