This application refers to the book “The JHipster Mini-Book by Matt Raible”. In this application the examples of the book are made using React instead of Angular.
This is the Angular Web App version.
Demo of dev master
Demo of 21 Points Health v1.0.0 (React)
Note that it takes +30 seconds to wake up in Heroku free account.
This application was generated using JHipster 5.4.1, you can find documentation and help at https://www.jhipster.tech/documentation-archive/v5.4.1.
Before you can build this project, you must install and configure the following dependencies on your machine:
After installing Node, you should be able to run the following command to install development tools.You will only need to run this command when dependencies change in package.json.
npm install
We use npm scripts and Webpack as our build system.
Run the following commands in two separate terminals to create a blissful development experience where your browserauto-refreshes when files change on your hard drive.
./mvnw
npm start
Npm is also used to manage CSS and JavaScript dependencies used in this application. You can upgrade dependencies byspecifying a newer version in package.json. You can also run npm update
and npm install
to manage dependencies.Add the help
flag on any command to see how you can use it. For example, npm help update
.
The npm run
command will list all of the scripts available to run for this project.
Service workers are commented by default, to enable them please uncomment the following code.
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('./service-worker.js')
.then(function() { console.log('Service Worker Registered'); });
}
</script>
Note: workbox creates the respective service worker and dynamically generate the service-worker.js
For example, to add Leaflet library as a runtime dependency of your application, you would run following command:
npm install --save --save-exact leaflet
To benefit from TypeScript type definitions from DefinitelyTyped repository in development, you would run following command:
npm install --save-dev --save-exact @types/leaflet
Then you would import the JS and CSS files specified in library's installation instructions so that Webpack knows about them:Note: there are still few other things remaining to do for Leaflet that we won't detail here.
For further instructions on how to develop with JHipster, have a look at Using JHipster in development.
To optimize the TwentyOnePointsReact application for production, run:
./mvnw -Pprod clean package
This will concatenate and minify the client CSS and JavaScript files. It will also modify index.html
so it references these new files.To ensure everything worked, run:
java -jar target/*.war
Then navigate to http://localhost:8080 in your browser.
Refer to Using JHipster in production for more details.
To launch your application's tests, run:
./mvnw clean test
Unit tests are run by Jest and written with Jasmine. They're located in src/test/javascript/ and can be run with:
npm test
UI end-to-end tests are powered by Protractor, which is built on top of WebDriverJS. They're located in src/test/javascript/e2eand can be run by starting Spring Boot in one terminal (./mvnw spring-boot:run
) and running the tests (npm run e2e
) in a second one.
For more information, refer to the Running tests page.
Sonar is used to analyse code quality. You can start a local Sonar server (accessible on http://localhost:9001) with:
docker-compose -f src/main/docker/sonar.yml up -d
Then, run a Sonar analysis:
./mvnw -Pprod clean test sonar:sonar
For more information, refer to the Code quality page.
You can use Docker to improve your JHipster development experience. A number of docker-compose configuration are available in the src/main/docker folder to launch required third party services.
For example, to start a mysql database in a docker container, run:
docker-compose -f src/main/docker/mysql.yml up -d
To stop it and remove the container, run:
docker-compose -f src/main/docker/mysql.yml down
You can also fully dockerize your application and all the services that it depends on.To achieve this, first build a docker image of your app by running:
./mvnw package -Pprod jib:dockerBuild
Then run:
docker-compose -f src/main/docker/app.yml up -d
For more information refer to Using Docker and Docker-Compose, this page also contains information on the docker-compose sub-generator (jhipster docker-compose
), which is able to generate docker configurations for one or several JHipster applications.
To configure CI for your project, run the ci-cd sub-generator (jhipster ci-cd
), this will let you generate configuration files for a number of Continuous Integration systems. Consult the Setting up Continuous Integration page for more information.
虚拟DOM: 1.本质是object类型的对象(一般对象) 2.虚拟DOM比较“轻”,真实DOM比较“重” 3.虚拟DOM最终会被React转化为真实DOM,呈现在页面上 jsx语法规则: 1.定义虚拟DOM时,不要写引号 2.标签中混入js表达式时要用{} 3.样式的类名指定不要用class,要用className 4.内联样式,要用 style={{key:value}} 的形式去写 5.虚拟
RN常用组件 view,scrollView,,text,statusBar,TextInput,image,button(不可定制样式没有style样式)pressable作为一个容器包裹 (onpressIn,onpressout,onpress,onlongpress),TouchableOpcaity设置透明度 Model:弹出一个遮盖全层的模态对话框 FlatList(平面列表) 横向
一、Web项目的架构类型 1991年之后:纯静态页面阶段 —— 内容永远不变 1994年左右:动态网页阶段/前后端代码混杂一起 —— 不同人不同时间访问其内容可能改变,ASPX/PHP/JSP,不足:代码的可读性可维护性差 1998年左右:AJAX阶段/前后端不分离 —— 静态内容和动态内容分处于不同的页面中(仍然运行于同一个服务器中),静态内容加载完成再使用XHR等技术异步请求动态内容 2010
一、JSX 中的 If-Else 来源 没法在JSX中使用 if-else 语句,因为 JSX 只是函数调用和对象创建的语法糖。 可以采用三元操作表达式: React.render(<div id={condition ? 'msg' : ''}>Hello World!</div>, mountNode); 当三元操作表达式不够健壮,你也可以使用 if 语句来决定应该渲染那个组件。 var lo
Given four integers sx, sy, tx, and ty, return true if it is possible to convert the point (sx, sy) to the point (tx, ty) through some operations, or false otherwise. The allowed operation on some poi
React 为高性能应用设计提供了许多优化方案,本文列举了其中的一些最佳实践。 在以下场景中,父组件和子组件通常会重新渲染: 在同一组件或父组件中调用 setState 时。 从父级收到的“props”的值发生变化。 调用组件中的 forceUpdate。 下面是提升 React 应用性能的 21 个技巧。 使用纯组件 如果 React 组件为相同的状态和 props 渲染相同的输出,则可以将其视
使用lazy loading app.js import React, { Component } from 'react'; import {Route, Switch,Redirect} from 'react-router-dom'; import Layout from './hoc/Layout/Layout'; import BurgerBuilder from './containe
AJAX AND APIs 1、在React中如何调用AJAX? 使用AJAX库:Axios, jQuery AJAX,the browser built-in window.fetch 2、应该在那个生命周期函数中调用AJAX获取数据? 在生命周期函数componentDidMount()中调用AJAX,并且可以调用SetState()设置state //API返回的JSON对象 {
说说你对自定义hooks的理解 通过自定义hooks,可以将组件逻辑提取到可重用的函数中。 可以理解为hooks就是用来放一些重复代码的函数。 通过闭包的方式给return出来,这是非常高级的方式 说说你对useMemo的理解 useMemo接收两个参数,分别是函数和一个数组(实际上是依赖项),函数里面return函数,数组内存放依赖 使用memo可以帮助我们优化性能,让react没必要执行不必
用处: 当我们想要父组件传值给子组件时,通常会使用props传值。 子组件传值给父组件时,通常会子组件中的事件触发一个回调函数(也是props),父组件中的对应函数再去修改值。 兄弟组件间传值,我通常会将子组件A的值传回父组件,父组件再传给子组件B 以上三种情况都可以使用消息订阅与发布机制来解决。 当然父传子还是用props比较好。 子组件传值给父组件,在子组件中发布,在父组件中订阅,就可以拿到相
React的安装 npm i react react-dom 使用React脚手架初始化项目 - 初始化项目,命令: npx create-react-app my-pro - npx 目的:提升包内提供的命令行工具的使用体验 - 原来:先安装脚手架包,再使用这个包中提供的命令 - 现在:无需安装脚手架包,就可以直接使用这个包提供的命令 - create-react-app 这个
21-Points Health To track your health and improve your life. �� This application was generated using JHipster 5.4.2, and serves as the sample application in the JHipster Mini-Book. Development Before
一个用于显示点的类。 由WebGLRenderer渲染的点使用 gl.POINTS。 构造器 Points( geometry : BufferGeometry, material : Material ) geometry —— (可选)是一个BufferGeometry的实例,默认值是一个新的BufferGeometry。 material —— (可选) 是一个对象,默认值是一个Points
This document covers the various contribution points that are defined in the package.json extension manifest. 这篇文档包含了package.json extension manifest中 contribution 选项的所有可用字段。 configuration commands key
Problem Metadata tags: Heap, Amazon, LinkedIn difficulty: Medium source(lintcode): https://www.lintcode.com/problem/k-closest-points/ Description Given some points and a point origin in two dimensiona
Max Points on a Line 描述 Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 分析 暴力枚举法。两点决定一条直线,n个点两两组合,可以得到$$\dfrac{1}{2}n(n+1)$$条直线,对每一条直线,判断n个点是否在该直线上,
Windsor 不打算支持所有情况和不确定的功能。相反,它公开了一组丰富的扩展点,你可以插入你自己的逻辑去扩展或修改 Windsor 的行为: 子系统(SubSystems) - Windsor 最核心的扩展点。很少被扩展或包装。 设施(Facilities) - 主要的扩展点。通常包含一个或多个下面列出的扩展点。 ComponentModel construction contributors