[React] Use the Fragment Short Syntax in Create React App 2.0
2023-09-14 08:59:17 时间
create-react-app version 2.0 added a lot of new features. One of the new features is upgrading to Babel Version 7, which enables the Short Syntax of React Fragments. Fragments have been a feature of React since version 16.2, but the Short Syntax hasn’t been available since Babel 7.0. Fragments let you wrap a group of children without adding an extra node to the DOM, which is helpful if you need a specific DOM structure.
import React, { Component, Fragment } from "react"; import "./App.css"; const Content = () => ( <> <nav>Navigation</nav> <main>Main area</main> </> ); class App extends Component { render() { return ( <div className="App"> <header>Header</header> <Content /> <footer>Footer</footer> </div> ); } } export default App;
相关文章
- 跨平台移动APP开发进阶(二):HTML5+、mui开发移动app教程[通俗易懂]
- 前端开发APP,从HBuilder开始~
- 篮茑中文编程开发的APP与VFP混搭,一个字“稳”
- Android 天气APP(三十六)运行到本地AS、更新项目版本依赖、去掉ButterKnife
- 中国香港服务器适合用来搭建app吗。
- 从微信小程序原理来看app如何搭建自己的小程序环境
- App自动化测试|原生app元素定位方法
- create-react-app中CSS Module不生效的解决办法
- 数据时代,APP如何进行数据可视化设计?
- 【错误记录】Android Studio 编译报错 ( Execution failed for task ‘:app:kaptDebugKotlin‘. A failure occurred w )
- 亚马逊App Store将在Win11发布前支持Android AAB安装包
- 360借条App恢复上架?官方回应:整改方案已通过验收
- 「唯物」从骑行App到智能把立,来看看野兽的“野心”是什么?
- 探索React框架中MySQL数据库的应用(react mssql)
- 利用Qt和MySQL构建App:快速下载详情(qtmysql下载)
- 让App连接MySQL轻松实现数据库连接(app连mysql)
- 拓展业务用App组合MySQL实现跨平台数据共享(app组合mysql)
- App无缝连接MySQL一种全新的解放方式(app直连mysql)
- App测试技术利用Mysql助力质量保障(app测试mysql)
- APP如何连接MySQL数据库(app怎样链接mysql)
- App联手Oracle实现多样化应用(app与oracle)
- 学习MYSQL必备下载一款视频APP,轻松入门数据库技术(MYSQL下载视频app)
- App与Oracle融合,拥抱数据驱动未来(app与oracle)
- 大牌美妆这样买才省钱 国美“折上折APP”教你省钱还免单