随笔分类 - React
摘要:In this lesson, we’ll make a few small changes to our scripts and add some environment variables that will be used at build time to get our applicatio
阅读全文
摘要:Starting from v15.5 if we wanted to use React's PropTypes we had to change our code to use a separate node module, now we can go one step further and
阅读全文
摘要:For example we have the following code: Because we wrote as function component, it is using the implicit return. To debug what props have been passed
阅读全文
摘要:In this lesson, we extend the styles of a base button component to create multiple variations of buttons, using "extend". We can then modify the base
阅读全文
摘要:In this lesson, we learn how to handle CSS keyframe animations in styled-components, via the 'keyframes' helper.
阅读全文
摘要:In this styled-components lesson, we set a "primary color" within a UI "theme" object. We make this theme accessible to all components by wrapping our
阅读全文
摘要:Most of the time, your components respond to events that occur within the component tree by defining their own handler or by accepting a handler defin
阅读全文
摘要:In this lesson, we see how we can apply styles globally with the "injectGlobal" helper method in styled-components. This method allows us to apply sty
阅读全文
摘要:In this lesson, we remove the mapping between a React component and the styles applied to it via classnames. We write our styles directly within the c
阅读全文
摘要:Some browsers, such as Safari < 10 & IE < 11, do not support the JavaScript Internationalization API, which react-intl depends on. In order to support
阅读全文
摘要:In some cases, you might need to pass a string from your intl messages.js file as a prop to a component. Instead of using react-intl components (which
阅读全文
摘要:Get 'injectIntl' from 'react-intl', it is a high order componet. We need to wrap our component into 'injectIntl': It will inject 'intl' prop into our
阅读全文
摘要:Using the react-intl FormattedMessage component, we’ll learn how to render content conditionally in our messages based on a number provided as a prop.
阅读全文
摘要:Using a react-intl FormattedNumber component, we'll pass a Number and a few additional props in order to render the correct separator and currency sym
阅读全文
摘要:Given a date, we’ll use the react-intl FormattedRelative component to render a date in a human readable format, such as “2 days ago”, in various langu
阅读全文
摘要:Using the react-intl FormattedDate and FormattedTime components, we’ll render a JavaScript Date into both a date string and a time string in different
阅读全文
摘要:In this lesson, we’ll use the react-intl FormattedHTMLMessage component to display text with dynamic values along with other HTML elements to create e
阅读全文
摘要:Learn how to use react-intl to set dynamic values into your language messages. We’ll also learn how to pass in those values by using a values prop in
阅读全文
摘要:We’ll install react-intl, then add it to the mounting point of our React app. Then, we’ll use react-intl helpers to load locales in our app, including
阅读全文
摘要:In this lesson we'll use CellMeasurer and CellMeasurerCache to automatically calculate and cache the height of a row. This will allow us to remove the
阅读全文