[React Intl] Render Content with Markup Using react-intl FormattedHTMLMessage
In this lesson, we’ll use the react-intl
FormattedHTMLMessage
component to display text with dynamic values along with other HTML elements to create emphasis on a piece of text.
Note: FormattedHTMLMessage
should be used sparingly because react-intl
cannot intelligently update the component by re-rendering only pieces that have changed. Instead, it has to re-render the entire component. If possible, use a FormattedMessage
component instead, and wrap that component with HTML markup.
For example we have the translation data as such:
'en-US': {
detail: {
window: '<small><em>All {numMerchants} links open in a new window.</em></small>',
}
}
It is a embbed HTML.
To use it we need to import 'FormattedHTMLMessage':
<FormattedHTMLMessage id="detail.window" values={{numMerchants: book.merchants.length}} />
[React Intl] Render Content with Markup Using react-intl FormattedHTMLMessage的更多相关文章
- [React Intl] Render Content Based on a Number using react-intl FormattedMessage (plural)
Using the react-intl FormattedMessage component, we’ll learn how to render content conditionally in ...
- [React Intl] Render Content with Placeholders using react-intl FormattedMessage
Learn how to use react-intl to set dynamic values into your language messages. We’ll also learn how ...
- react之——render prop
在react “从上至下的数据流原则” 背景下,常规的消息传递机制就是通过prop属性,把父级数据传递给子级,这样一种数据流通模式决定了——数据的接收方子组件要被”硬植入“进数据的数据的给予方父组件, ...
- [React] Render Text Only Components in React 16
In this session we create a comment component to explore how to create components that only render t ...
- react解析: render的FiberRoot(三)
react解析: render的FiberRoot(三) 感谢 yck: 剖析 React 源码解析,本篇文章是在读完他的文章的基础上,将他的文章进行拆解和加工,加入我自己的一下理解和例子,便于大家理 ...
- React components render order All In One
React components render order All In One components render order / components lifecycle DOM tree ren ...
- React中render Props模式
React组件复用 React组件复用的方式有两种: 1.render Props模式 2.高阶组件HOC 上面说的这两种方式并不是新的APi. 而是利用Raect自身的编码特点,演化而来的固定编码写 ...
- [React Intl] Use Webpack to Conditionally Include an Intl Polyfill for Older Browsers
Some browsers, such as Safari < 10 & IE < 11, do not support the JavaScript Internationali ...
- React 源码剖析系列 - 不可思议的 react diff
简单点的重复利用已有的dom和其他REACT性能快的原理. key的作用和虚拟节点 目前,前端领域中 React 势头正盛,使用者众多却少有能够深入剖析内部实现机制和原理. 本系列文章希望通过剖析 ...
随机推荐
- 用console.log分析Vue源码
前言 本文通过console.log的一些特性,结合vue.js的源码,通过一个简单的例子,让你了解Vue的各个过程的变化. 控制台输出的效果图 请用chrome查看,并打开控制台看效果 演示地址 准 ...
- 压状态bfs
一般地图很小,状态不多,可以装压或者hash,构造压缩或hash的函数,构造还原地图的函数,然后就无脑bfs(感觉就是SPFA) 题目: 1.玩具游戏:二进制压缩状态 #include<cstd ...
- HDU——T 2594 Simpsons’ Hidden Talents
http://acm.hdu.edu.cn/showproblem.php?pid=2594 Time Limit: 2000/1000 MS (Java/Others) Memory Limi ...
- linux中内存泄漏的检測(五)记录内存泄漏的代码
到眼下为止,先后通过wrap malloc.new函数重载和计算指针内存大小的方法.基本上满足了对内存泄漏检測的须要. 假设发现了内存泄漏.那么就要找到内存泄漏的地方而且修正它了. 茫茫代码.如何去找 ...
- Android控件开发之Gallery3D效果
package xiaosi.GalleryFlow; import android.app.Activity; import android.os.Bundle; public class Gall ...
- native.js是什么且如何使用
native.js是什么且如何使用 一.总结 一句话总结:Native.js技术,简称NJS,是一种将手机操作系统的原生对象转义,映射为JS对象,在JS里编写原生代码的技术.Native.js不是一个 ...
- [ Tomcat ] [ startup ] Tomcat 無法在時限內開啟問題
http://www.ewdna.com/2011/12/tomcat-server-in-eclipse-unable-to.html
- 一个统一将数据转换为JSON的方法
这是我得方法: 导包: import net.sf.json.JSONArray; import net.sf.json.JSONObject; public void writeJson(Objec ...
- 关于Webpack详述系列文章 (第三篇)
1. 类图 1. 模块 Module是webpack中最核心的类,要加载定的一切和依赖都是Module. 它有很多子类 RawModule NormalModule MultiModule Conte ...
- Node中的JavaScript和浏览器中的JavaScript的区别
浏览器中的JavaScript: 1.基于ECMAscript规范,这个规范规定了语法 2.添加了dom:用来处理文档 document object model 3.添加了BOM:用于操作浏览器 w ...