[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 势头正盛,使用者众多却少有能够深入剖析内部实现机制和原理. 本系列文章希望通过剖析 ...
随机推荐
- PHP 使用Apache 中的ab 測试站点的压力性能
打开Apacheserver的安装路径(我用的是 WampServer),在bin文件夹中有一个ab.exe的可运行程序,它就是要介绍的压力測试工具. watermark/2/text/aHR0cDo ...
- POJ 3592 Instantaneous Transference(强连通+DP)
POJ 3592 Instantaneous Transference 题目链接 题意:一个图.能往右和下走,然后有*能够传送到一个位置.'#'不能走.走过一个点能够获得该点上面的数字值,问最大能获得 ...
- PHP开发常规安全问题总结
文章来源:PHP开发学习门户 地址:http://www.phpthinking.com/archives/575 php给了开发人员极大的灵活性,可是这也为安全问题带来了潜在的隐患,最近须要总结一下 ...
- HDU 2886 Lou 1 Zhuang
思维好重要.. 对于n+m == k , 当n == m || abs(n-m) == 1 时n*m取得最大值. 设 s = x*(l-x),s = lx-x^2.其导函数为 s' = -1/2x + ...
- 视图中使用ROWNUM要注意
昨天晚上帮一位兄弟优化一个ebs的sql. sql有好几百行. SQL的样子是select .... from 视图 where ....过滤条件 视图的代码贴出来就不给大家看了,比較长.另外设计保密 ...
- strongSwan IKEv2服务器配置
strongSwan IKEv2服务器配置 资料来源 https://www.cl.cam.ac.uk/~mas90/resources/strongswan/ 经过大量的反复试验,我配置了一个str ...
- js中Object.defineProperties 定义一个在原对象可读可写的方法
function A(){ this.name = 'hellow word'; } Object.defineProperties( A.prototype,{ doSomething2 : { v ...
- spark源码阅读
根据spark2.2的编译顺序来确定源码阅读顺序,只阅读核心的基本部分. 1.common目录 ①Tags②Sketch③Networking④Shuffle Streaming Service⑤Un ...
- 信号 signal sigaction补充
目前linux中的signal()是通过sigation()函数实现的. 由signal()安装的实时信号支持排队,同样不会丢失. 先看signal 和 sigaction 的区别: 关键是 stru ...
- [React] Compound Component (React.Children.map & React.cloneElement)
Imaging you are building a Tabs component. If looks like: <Tabs> <TabList> <Tab> o ...