[React] Preview and edit a component live with React Live
In this lesson we'll use React Live to preview and edit a component directly in the browser. React Live is a great tool for rendering interactive documentation or any place you would like to demonstrate a React component with a live preview and editing capabilities.
Additional Resources https://github.com/FormidableLabs/react-live
Install:
npm i react-live --save
Code:
import React from 'react';
import {LiveEditor, LivePreview, LiveError, LiveProvider} from 'react-live'; const code = `
class App extends React.Component {
render() {
return (
<div className="App">
<header className="App-header">
<h1 className="App-title">Welcome to React</h1>
</header>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
);
}
}`; const AppLive = () => (
<LiveProvider code={code} >
<LiveEditor />
<LivePreview />
<LiveError />
</LiveProvider>
); export default AppLive;
It can work with mdx-deck in presentation: Github
[React] Preview and edit a component live with React Live的更多相关文章
- [React] Use React.memo with a Function Component to get PureComponent Behavior
A new Higher Order Component (HOC) was recently released in React v16.6.0 called React.memo. This be ...
- [React] Refactor a Stateful List Component to a Functional Component with React PowerPlug
In this lesson we'll look at React PowerPlug's <List /> component by refactoring a normal clas ...
- Wait… What Happens When my React Native Application Starts? — An In-depth Look Inside React Native
Discover how React Native functions internally, and what it does for you without you knowing it. Dis ...
- React与ES6(四)ES6如何处理React mixins
React与ES6系列: React与ES6(一)开篇介绍 React和ES6(二)ES6的类和ES7的property initializer React与ES6(三)ES6类和方法绑定 React ...
- react看这篇就够了(react+webpack+redux+reactRouter+sass)
本帖将对一下内容进行分享: 1.webpack环境搭建: 2.如何使用react-router: 3.引入sass预编译: 4.react 性能优化方案: 5.redux结合react使用: 6.fe ...
- 玩转 React 【第03期】:邂逅 React 组件
上期回顾 前文我们讲解了 React 模板 JSX,接着我们继续来看看 React 组件又是如何工作的呢? 组件化开发到了今天已经是大家的共识,在 React 中,组件同样也是组成我们整个项目的基本单 ...
- [React] Use the Fragment Short Syntax in Create React App 2.0
create-react-app version 2.0 added a lot of new features. One of the new features is upgrading to Ba ...
- react,react-router,redux+react-redux 构建一个React Demo
创建初始化应用 加速我们的npm. npm install -g cnpm --registry=https://registry.npm.taobao.org 利用create-react-app ...
- 【React自制全家桶】一、Webstrom+React+Ant Design+echarts搭建react项目
前言 一.React是Facebook推出的一个前端框架,之前被用于著名的社交媒体Instagram中,后来由于取得了不错的反响,于是Facebook决定将其开源.出身名门的React也不负众望,成功 ...
随机推荐
- java web 学习笔记 - servlet01
---恢复内容开始--- 1.Servlet介绍 Servlet 是用java语言编写的服务器端小程序,属于一个CGI程序,但与传统的CGI不同的是,它是多线程实现的,并且可以多平台移植. 用户自定义 ...
- POJ_1125_(dijkstra)
Stockbroker Grapevine Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 35553 Accepted: ...
- org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [********] will not be managed by Spring
如下图,查看层次是否正确.
- 《Java程序设计》课程试题
< Java程序设计 >课程试题 一.单项选择题(20题:每题2分,共40分) 1.若数组a定义为int[][]a=new int[3][4],则a是___. A)一维数组 B)二维数组 ...
- Parker Gear Pump - Gear Pump Seal Is More O-Ring: Role
Parker Gear Pump introduction Gear pump lip seal is mainly used in reciprocating dynamic seals. C ...
- 在vue中场景,循环行,点击当前行编辑数据
当前列表 点击编辑,行变为编辑框. <Row style="color:#999;margin-bottom:11px"> <Row style="ma ...
- Json Web Token(JWT)详解
什么是Json Web Token Json web token (JWT), 是为了在网络应用环境间传递声明而执行的一种基于JSON的开放标准((RFC 7519).该token被设计为紧凑且安全的 ...
- cc.Node—坐标系统
cc.Vec21: cc.Vec2 二维向量坐标, 表结构{x: 120, y: 120}; cc.v2(x, y) 创建一个二维向量 cc.p() 创建一个二外向量;2: cc.pSub: 向量相减 ...
- 样例GeoQuiz应用开发 第2章
先介绍一下MVC,Model View Controller,是软件架构中最常见的一种框架. 简单来说就是通过 controller 的控制去操作 model 层的数据,并且返回给 view 层展示, ...
- 五段实用的js高级技巧
技巧一之setTimeout. 应用案例:比如你想一个函数循环执行10次,怎么办?以前通常是先setInterval,然后clearInterval,技巧一就是克服这个问题 复制代码 代码如下: (f ...