react Around the halls: Brookings experts on the Middle East react to the White House’s peace plan By webfeeds.brookings.edu Published On :: Wed, 29 Jan 2020 16:33:09 +0000 On January 28 at the White House, President Trump unveiled his plan for Middle East peace alongside Israeli Prime Minister Benjanim Netanyahu. Below, Brookings experts on the peace process and the region more broadly offer their initial takes on the announcement. Natan Sachs (@natansachs), Director of the Center for Middle East Policy: This is a… Full Article
react Why 'Kill it with Fire' Should Not be Your Reaction to a Honeybee Swarm By www.treehugger.com Published On :: Thu, 17 May 2012 05:05:00 -0400 It's not a bee attack -- it's just a bee swarm. Here are tips on how to deal with one. Full Article Living
react 100% nuclear free: Japan shuts down its last reactor By www.treehugger.com Published On :: Mon, 16 Sep 2013 15:21:46 -0400 On Monday (Sunday locally), Japan switched off the last of its operating nuclear reactors and became 100% nuclear-free. Full Article Energy
react Jellyfish swarm clogs nuclear reactor By www.treehugger.com Published On :: Wed, 02 Oct 2013 15:33:28 -0400 Tons of jellyfish clog a water intake pipe at the Oskarshamn power plant in Sweden, forcing operators to shut down the reactor. Full Article Science
react Nuclear fusion reactor in just five years? By www.treehugger.com Published On :: Tue, 11 Aug 2015 23:00:00 -0400 MIT design cuts fusion reactor down to a size that would be more cost effective and could be built in five years Full Article Business
react Ontario Reacts to Live Asian Carp Spilled in River By www.treehugger.com Published On :: Sat, 04 Jun 2011 11:49:38 -0400 This was an actual test. But only a test. Like those emergency tones you hear on your TV when a storm is approaching. Officials in Ontario, Canada, think the possibility of a live Asian carp invasion via truck is real. People Full Article Business
react How would you react if your kid's school announced it was 'zero waste'? By www.treehugger.com Published On :: Fri, 06 Sep 2019 07:00:00 -0400 It turns out that some parents are less than thrilled. Full Article Living
react Russia launches floating nuclear reactor By www.treehugger.com Published On :: Thu, 22 Aug 2019 08:21:41 -0400 What could possibly go wrong? Full Article Energy
react Citizen scientist website could reveal how jellyfish are reacting to a warming world By www.treehugger.com Published On :: Wed, 02 Dec 2015 09:46:20 -0500 Jellywatch.org has tapped into the power of citizen scientists to collect data on jellyfish populations and you can help. Full Article Technology
react Kenyan students design biowaste reactor to harvest dormitory waste By www.treehugger.com Published On :: Tue, 24 May 2016 06:27:30 -0400 Opportunities are everywhere. Even in poop. Full Article Energy
react A Landmark Ruling Against Agrochemicals in Argentina Receives Mixed Reactions By www.treehugger.com Published On :: Tue, 21 Aug 2012 18:42:48 -0400 In a decade-long case by a group of plaintiffs, a court sentenced a farmer and an aviator to prison for spraying agrochemicals, linking them to environmental pollution and health hazards. Only they can skip doing any time. Full Article Business
react Artists' salvaged tire installations reactivate Barcelona's streets By www.treehugger.com Published On :: Sat, 23 May 2015 07:00:00 -0400 These simple but intriguing urban art sculptures made out of repurposed tires bring a new sense of place to some of Barcelona's neglected streets. Full Article Living
react Are markets overreacting to Yellen? By www.cnbc.com Published On :: Sat, 10 Mar 2018 01:38:12 GMT Randy Kroszner, Professor Of Economics at the University of Chicago Booth School of Business, discusses the selloff on Wall Street after Yellen indicated that rate hikes could happen sooner than expected. Full Article
react Jim Cramer reacts to AMD, Starbucks, Boeing, GE and Alphabet earnings reports By www.cnbc.com Published On :: Wed, 29 Apr 2020 22:48:46 GMT The "Mad Money" host offered his thoughts on each companies' latest quarterly results and recommended multiple stocks for buys. Full Article
react Beyond Meat CEO reacts to beef and pork shortages, talks 'real opportunity' this summer By www.cnbc.com Published On :: Wed, 06 May 2020 22:52:30 GMT Beyond Meat CEO Ethan Brown said the meat industry is "reaching a tipping point" and the plant-based meat producer sees a chance to win over new consumers. Full Article
react Did the Victorians have faster reactions? By mindhacks.com Published On :: Tue, 03 Apr 2018 21:16:18 +0000 Psychologists have been measuring reaction times since before psychology existed, and they are still a staple of cognitive psychology experiments today. Typically psychologists look for a difference in the time it takes participants to respond to stimuli under different conditions as evidence of differences in how cognitive processing occurs in those conditions. Galton, the famous … Continue reading "Did the Victorians have faster reactions?" Full Article Nonsense
react celebs react By www.toothpastefordinner.com Published On :: Mon, 01 Feb 2016 04:00:00 EST Today on Toothpaste For Dinner: celebs reactThe Worst Things For Sale is Drew's blog. It updates every day. Subscribe to the Worst Things For Sale RSS! Full Article comic
react dads react to By www.toothpastefordinner.com Published On :: Fri, 06 Jul 2018 04:00:00 EDT Today on Toothpaste For Dinner: dads react toThe Worst Things For Sale is Drew's blog. It updates every day. Subscribe to the Worst Things For Sale RSS! Full Article comic
react kids react to By www.toothpastefordinner.com Published On :: Wed, 26 Sep 2018 04:00:00 EDT Today on Toothpaste For Dinner: kids react toThe Worst Things For Sale is Drew's blog. It updates every day. Subscribe to the Worst Things For Sale RSS! Full Article comic
react Yes, the dam is breaking. The exploding reaction to the polyam 'House Hunters' episode By feedproxy.google.com Published On :: Thu, 20 Feb 2020 14:27:00 +0000 Full Article house hunters polyamory on TV TV
react React v16.9.0 and the Roadmap Update By reactjs.org Published On :: Thu, 08 Aug 2019 00:00:00 GMT Today we are releasing React 16.9. It contains several new features, bugfixes, and new deprecation warnings to help prepare for a future major release. New Deprecations Renaming Unsafe Lifecycle Methods Over a year ago, we announced that unsafe lifecycle methods are getting renamed: componentWillMount → UNSAFE_componentWillMount componentWillReceiveProps → UNSAFE_componentWillReceiveProps componentWillUpdate → UNSAFE_componentWillUpdate React 16.9 does not contain breaking changes, and the old names continue to work in this release. But you will now see a warning when using any of the old names: As the warning suggests, there are usually better approaches for each of the unsafe methods. However, maybe you don’t have the time to migrate or test these components. In that case, we recommend running a “codemod” script that renames them automatically: cd your_project npx react-codemod rename-unsafe-lifecycles (Note that it says npx, not npm. npx is a utility that comes with Node 6+ by default.) Running this codemod will replace the old names like componentWillMount with the new names like UNSAFE_componentWillMount: The new names like UNSAFE_componentWillMount will keep working in both React 16.9 and in React 17.x. However, the new UNSAFE_ prefix will help components with problematic patterns stand out during the code review and debugging sessions. (If you’d like, you can further discourage their use inside your app with the opt-in Strict Mode.) Note Learn more about our versioning policy and commitment to stability. Deprecating javascript: URLs URLs starting with javascript: are a dangerous attack surface because it’s easy to accidentally include unsanitized output in a tag like <a href> and create a security hole: const userProfile = { website: "javascript: alert('you got hacked')", }; // This will now warn: <a href={userProfile.website}>Profile</a> In React 16.9, this pattern continues to work, but it will log a warning. If you use javascript: URLs for logic, try to use React event handlers instead. (As a last resort, you can circumvent the protection with dangerouslySetInnerHTML, but it is highly discouraged and often leads to security holes.) In a future major release, React will throw an error if it encounters a javascript: URL. Deprecating “Factory” Components Before compiling JavaScript classes with Babel became popular, React had support for a “factory” component that returns an object with a render method: function FactoryComponent() { return { render() { return <div />; } } } This pattern is confusing because it looks too much like a function component — but it isn’t one. (A function component would just return the <div /> in the above example.) This pattern was almost never used in the wild, and supporting it causes React to be slightly larger and slower than necessary. So we are deprecating this pattern in 16.9 and logging a warning if it’s encountered. If you rely on it, adding FactoryComponent.prototype = React.Component.prototype can serve as a workaround. Alternatively, you can convert it to either a class or a function component. We don’t expect most codebases to be affected by this. New Features Async act() for Testing React 16.8 introduced a new testing utility called act() to help you write tests that better match the browser behavior. For example, multiple state updates inside a single act() get batched. This matches how React already works when handling real browser events, and helps prepare your components for the future in which React will batch updates more often. However, in 16.8 act() only supported synchronous functions. Sometimes, you might have seen a warning like this in a test but could not easily fix it: An update to SomeComponent inside a test was not wrapped in act(...). In React 16.9, act() also accepts asynchronous functions, and you can await its call: await act(async () => { // ... }); This solves the remaining cases where you couldn’t use act() before, such as when the state update was inside an asynchronous function. As a result, you should be able to fix all the remaining act() warnings in your tests now. We’ve heard there wasn’t enough information about how to write tests with act(). The new Testing Recipes guide describes common scenarios, and how act() can help you write good tests. These examples use vanilla DOM APIs, but you can also use React Testing Library to reduce the boilerplate code. Many of its methods already use act() internally. Please let us know on the issue tracker if you bump into any other scenarios where act() doesn’t work well for you, and we’ll try to help. Performance Measurements with <React.Profiler> In React 16.5, we introduced a new React Profiler for DevTools that helps find performance bottlenecks in your application. In React 16.9, we are also adding a programmatic way to gather measurements called <React.Profiler>. We expect that most smaller apps won’t use it, but it can be handy to track performance regressions over time in larger apps. The <Profiler> measures how often a React application renders and what the “cost” of rendering is. Its purpose is to help identify parts of an application that are slow and may benefit from optimizations such as memoization. A <Profiler> can be added anywhere in a React tree to measure the cost of rendering that part of the tree. It requires two props: an id (string) and an onRender callback (function) which React calls any time a component within the tree “commits” an update. render( <Profiler id="application" onRender={onRenderCallback}> <App> <Navigation {...props} /> <Main {...props} /> </App> </Profiler>); To learn more about the Profiler and the parameters passed to the onRender callback, check out the Profiler docs. Note: Profiling adds some additional overhead, so it is disabled in the production build. To opt into production profiling, React provides a special production build with profiling enabled. Read more about how to use this build at fb.me/react-profiling. Notable Bugfixes This release contains a few other notable improvements: A crash when calling findDOMNode() inside a <Suspense> tree has been fixed. A memory leak caused by retaining deleted subtrees has been fixed too. An infinite loop caused by setState in useEffect now logs an error. (This is similar to the error you see when you call setState in componentDidUpdate in a class.) We’re thankful to all the contributors who helped surface and fix these and other issues. You can find the full changelog below. An Update to the Roadmap In November 2018, we have posted this roadmap for the 16.x releases: A minor 16.x release with React Hooks (past estimate: Q1 2019) A minor 16.x release with Concurrent Mode (past estimate: Q2 2019) A minor 16.x release with Suspense for Data Fetching (past estimate: mid 2019) These estimates were too optimistic, and we’ve needed to adjust them. tldr: We shipped Hooks on time, but we’re regrouping Concurrent Mode and Suspense for Data Fetching into a single release that we intend to release later this year. In February, we shipped a stable 16.8 release including React Hooks, with React Native support coming a month later. However, we underestimated the follow-up work for this release, including the lint rules, developer tools, examples, and more documentation. This shifted the timeline by a few months. Now that React Hooks are rolled out, the work on Concurrent Mode and Suspense for Data Fetching is in full swing. The new Facebook website that’s currently in active development is built on top of these features. Testing them with real code helped discover and address many issues before they can affect the open source users. Some of these fixes involved an internal redesign of these features, which has also caused the timeline to slip. With this new understanding, here’s what we plan to do next. One Release Instead of Two Concurrent Mode and Suspense power the new Facebook website that’s in active development, so we are confident that they’re close to a stable state technically. We also now better understand the concrete steps before they are ready for open source adoption. Originally we thought we would split Concurrent Mode and Suspense for Data Fetching into two releases. We’ve found that this sequencing is confusing to explain because these features are more related than we thought at first. So we plan to release support for both Concurrent Mode and Suspense for Data Fetching in a single combined release instead. We don’t want to overpromise the release date again. Given that we rely on both of them in production code, we expect to provide a 16.x release with opt-in support for them this year. An Update on Data Fetching While React is not opinionated about how you fetch data, the first release of Suspense for Data Fetching will likely focus on integrating with opinionated data fetching libraries. For example, at Facebook we are using upcoming Relay APIs that integrate with Suspense. We will document how other opinionated libraries like Apollo can support a similar integration. In the first release, we don’t intend to focus on the ad-hoc “fire an HTTP request” solution we used in earlier demos (also known as “React Cache”). However, we expect that both we and the React community will be exploring that space in the months after the initial release. An Update on Server Rendering We have started the work on the new Suspense-capable server renderer, but we don’t expect it to be ready for the initial release of Concurrent Mode. This release will, however, provide a temporary solution that lets the existing server renderer emit HTML for Suspense fallbacks immediately, and then render their real content on the client. This is the solution we are currently using at Facebook ourselves until the streaming renderer is ready. Why Is It Taking So Long? We’ve shipped the individual pieces leading up to Concurrent Mode as they became stable, including new context API, lazy loading with Suspense, and Hooks. We are also eager to release the other missing parts, but trying them at scale is an important part of the process. The honest answer is that it just took more work than we expected when we started. As always, we appreciate your questions and feedback on Twitter and in our issue tracker. Installation React React v16.9.0 is available on the npm registry. To install React 16 with Yarn, run: yarn add react@^16.9.0 react-dom@^16.9.0 To install React 16 with npm, run: npm install --save react@^16.9.0 react-dom@^16.9.0 We also provide UMD builds of React via a CDN: <script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script> <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script> Refer to the documentation for detailed installation instructions. Changelog React Add <React.Profiler> API for gathering performance measurements programmatically. (@bvaughn in #15172) Remove unstable_ConcurrentMode in favor of unstable_createRoot. (@acdlite in #15532) React DOM Deprecate old names for the UNSAFE_* lifecycle methods. (@bvaughn in #15186 and @threepointone in #16103) Deprecate javascript: URLs as a common attack surface. (@sebmarkbage in #15047) Deprecate uncommon “module pattern” (factory) components. (@sebmarkbage in #15145) Add support for the disablePictureInPicture attribute on <video>. (@eek in #15334) Add support for onLoad event for <embed>. (@cherniavskii in #15614) Add support for editing useState state from DevTools. (@bvaughn in #14906) Add support for toggling Suspense from DevTools. (@gaearon in #15232) Warn when setState is called from useEffect, creating a loop. (@gaearon in #15180) Fix a memory leak. (@paulshen in #16115) Fix a crash inside findDOMNode for components wrapped in <Suspense>. (@acdlite in #15312) Fix pending effects from being flushed too late. (@acdlite in #15650) Fix incorrect argument order in a warning message. (@brickspert in #15345) Fix hiding Suspense fallback nodes when there is an !important style. (@acdlite in #15861 and #15882) Slightly improve hydration performance. (@bmeurer in #15998) React DOM Server Fix incorrect output for camelCase custom CSS property names. (@bedakb in #16167) React Test Utilities and Test Renderer Add act(async () => ...) for testing asynchronous state updates. (@threepointone in #14853) Add support for nesting act from different renderers. (@threepointone in #16039 and #16042) Warn in Strict Mode if effects are scheduled outside an act() call. (@threepointone in #15763 and #16041) Warn when using act from the wrong renderer. (@threepointone in #15756) Full Article
react Introducing the New React DevTools By reactjs.org Published On :: Thu, 15 Aug 2019 00:00:00 GMT We are excited to announce a new release of the React Developer Tools, available today in Chrome, Firefox, and (Chromium) Edge! What’s changed? A lot has changed in version 4! At a high level, this new version should offer significant performance gains and an improved navigation experience. It also offers full support for React Hooks, including inspecting nested objects. Visit the interactive tutorial to try out the new version or see the changelog for demo videos and more details. Which versions of React are supported? react-dom 0-14.x: Not supported 15.x: Supported (except for the new component filters feature) 16.x: Supported react-native 0-0.61: Not supported 0.62: Will be supported (when 0.62 is released) How do I get the new DevTools? React DevTools is available as an extension for Chrome and Firefox. If you have already installed the extension, it should update automatically within the next couple of hours. If you use the standalone shell (e.g. in React Native or Safari), you can install the new version from NPM: npm install -g react-devtools@^4 Where did all of the DOM elements go? The new DevTools provides a way to filter components from the tree to make it easier to navigate deeply nested hierarchies. Host nodes (e.g. HTML <div>, React Native <View>) are hidden by default, but this filter can be disabled: How do I get the old version back? If you are working with React Native version 60 (or older) you can install the previous release of DevTools from NPM: npm install --dev react-devtools@^3 For older versions of React DOM (v0.14 or earlier) you will need to build the extension from source: # Checkout the extension source git clone https://github.com/facebook/react-devtools cd react-devtools # Checkout the previous release branch git checkout v3 # Install dependencies and build the unpacked extension yarn install yarn build:extension # Follow the on-screen instructions to complete installation Thank you! We’d like to thank everyone who tested the early release of DevTools version 4. Your feedback helped improve this initial release significantly. We still have many exciting features planned and feedback is always welcome! Please feel free to open a GitHub issue or tag @reactjs on Twitter. Full Article
react Preparing for the Future with React Prereleases By reactjs.org Published On :: Tue, 22 Oct 2019 00:00:00 GMT To share upcoming changes with our partners in the React ecosystem, we’re establishing official prerelease channels. We hope this process will help us make changes to React with confidence, and give developers the opportunity to try out experimental features. This post will be most relevant to developers who work on frameworks, libraries, or developer tooling. Developers who use React primarily to build user-facing applications should not need to worry about our prerelease channels. React relies on a thriving open source community to file bug reports, open pull requests, and submit RFCs. To encourage feedback, we sometimes share special builds of React that include unreleased features. Because the source of truth for React is our public GitHub repository, it’s always been possible to build a copy of React that includes the latest changes. However it’s much easier for developers to install React from npm, so we occasionally publish prerelease builds to the npm registry. A recent example is the 16.7 alpha, which included an early version of the Hooks API. We would like to make it even easier for developers to test prerelease builds of React, so we’re formalizing our process with three separate release channels. Release Channels The information in this post is also available on our Release Channels page. We will update that document whenever there are changes to our release process. Each of React’s release channels is designed for a distinct use case: Latest is for stable, semver React releases. It’s what you get when you install React from npm. This is the channel you’re already using today. Use this for all user-facing React applications. Next tracks the master branch of the React source code repository. Think of these as release candidates for the next minor semver release. Use this for integration testing between React and third party projects. Experimental includes experimental APIs and features that aren’t available in the stable releases. These also track the master branch, but with additional feature flags turned on. Use this to try out upcoming features before they are released. All releases are published to npm, but only Latest uses semantic versioning. Prereleases (those in the Next and Experimental channels) have versions generated from a hash of their contents, e.g. 0.0.0-1022ee0ec for Next and 0.0.0-experimental-1022ee0ec for Experimental. The only officially supported release channel for user-facing applications is Latest. Next and Experimental releases are provided for testing purposes only, and we provide no guarantees that behavior won’t change between releases. They do not follow the semver protocol that we use for releases from Latest. By publishing prereleases to the same registry that we use for stable releases, we are able to take advantage of the many tools that support the npm workflow, like unpkg and CodeSandbox. Latest Channel Latest is the channel used for stable React releases. It corresponds to the latest tag on npm. It is the recommended channel for all React apps that are shipped to real users. If you’re not sure which channel you should use, it’s Latest. If you’re a React developer, this is what you’re already using. You can expect updates to Latest to be extremely stable. Versions follow the semantic versioning scheme. Learn more about our commitment to stability and incremental migration in our versioning policy. Next Channel The Next channel is a prerelease channel that tracks the master branch of the React repository. We use prereleases in the Next channel as release candidates for the Latest channel. You can think of Next as a superset of Latest that is updated more frequently. The degree of change between the most recent Next release and the most recent Latest release is approximately the same as you would find between two minor semver releases. However, the Next channel does not conform to semantic versioning. You should expect occasional breaking changes between successive releases in the Next channel. Do not use prereleases in user-facing applications. Releases in Next are published with the next tag on npm. Versions are generated from a hash of the build’s contents, e.g. 0.0.0-1022ee0ec. Using the Next Channel for Integration Testing The Next channel is designed to support integration testing between React and other projects. All changes to React go through extensive internal testing before they are released to the public. However, there are myriad environments and configurations used throughout the React ecosystem, and it’s not possible for us to test against every single one. If you’re the author of a third party React framework, library, developer tool, or similar infrastructure-type project, you can help us keep React stable for your users and the entire React community by periodically running your test suite against the most recent changes. If you’re interested, follow these steps: Set up a cron job using your preferred continuous integration platform. Cron jobs are supported by both CircleCI and Travis CI. In the cron job, update your React packages to the most recent React release in the Next channel, using next tag on npm. Using the npm cli: npm update react@next react-dom@next Or yarn: yarn upgrade react@next react-dom@next Run your test suite against the updated packages. If everything passes, great! You can expect that your project will work with the next minor React release. If something breaks unexpectedly, please let us know by filing an issue. A project that uses this workflow is Next.js. (No pun intended! Seriously!) You can refer to their CircleCI configuration as an example. Experimental Channel Like Next, the Experimental channel is a prerelease channel that tracks the master branch of the React repository. Unlike Next, Experimental releases include additional features and APIs that are not ready for wider release. Usually, an update to Next is accompanied by a corresponding update to Experimental. They are based on the same source revision, but are built using a different set of feature flags. Experimental releases may be significantly different than releases to Next and Latest. Do not use Experimental releases in user-facing applications. You should expect frequent breaking changes between releases in the Experimental channel. Releases in Experimental are published with the experimental tag on npm. Versions are generated from a hash of the build’s contents, e.g. 0.0.0-experimental-1022ee0ec. What Goes Into an Experimental Release? Experimental features are ones that are not ready to be released to the wider public, and may change drastically before they are finalized. Some experiments may never be finalized — the reason we have experiments is to test the viability of proposed changes. For example, if the Experimental channel had existed when we announced Hooks, we would have released Hooks to the Experimental channel weeks before they were available in Latest. You may find it valuable to run integration tests against Experimental. This is up to you. However, be advised that Experimental is even less stable than Next. We do not guarantee any stability between Experimental releases. How Can I Learn More About Experimental Features? Experimental features may or may not be documented. Usually, experiments aren’t documented until they are close to shipping in Next or Stable. If a feature is not documented, they may be accompanied by an RFC. We will post to the React blog when we’re ready to announce new experiments, but that doesn’t mean we will publicize every experiment. You can always refer to our public GitHub repository’s history for a comprehensive list of changes. Full Article
react React v16.13.0 By reactjs.org Published On :: Wed, 26 Feb 2020 00:00:00 GMT Today we are releasing React 16.13.0. It contains bugfixes and new deprecation warnings to help prepare for a future major release. New Warnings Warnings for some updates during render A React component should not cause side effects in other components during rendering. It is supported to call setState during render, but only for the same component. If you call setState during a render on a different component, you will now see a warning: Warning: Cannot update a component from inside the function body of a different component. This warning will help you find application bugs caused by unintentional state changes. In the rare case that you intentionally want to change the state of another component as a result of rendering, you can wrap the setState call into useEffect. Warnings for conflicting style rules When dynamically applying a style that contains longhand and shorthand versions of CSS properties, particular combinations of updates can cause inconsistent styling. For example: <div style={toggle ? { background: 'blue', backgroundColor: 'red' } : { backgroundColor: 'red' } }> ... </div> You might expect this <div> to always have a red background, no matter the value of toggle. However, on alternating the value of toggle between true and false, the background color start as red, then alternates between transparent and blue, as you can see in this demo. React now detects conflicting style rules and logs a warning. To fix the issue, don’t mix shorthand and longhand versions of the same CSS property in the style prop. Warnings for some deprecated string refs String Refs is an old legacy API which is discouraged and is going to be deprecated in the future: <Button ref="myRef" /> (Don’t confuse String Refs with refs in general, which remain fully supported.) In the future, we will provide an automated script (a “codemod”) to migrate away from String Refs. However, some rare cases can’t be migrated automatically. This release adds a new warning only for those cases in advance of the deprecation. For example, it will fire if you use String Refs together with the Render Prop pattern: class ClassWithRenderProp extends React.Component { componentDidMount() { doSomething(this.refs.myRef); } render() { return this.props.children(); } } class ClassParent extends React.Component { render() { return ( <ClassWithRenderProp> {() => <Button ref="myRef" />} </ClassWithRenderProp> ); } } Code like this often indicates bugs. (You might expect the ref to be available on ClassParent, but instead it gets placed on ClassWithRenderProp). You most likely don’t have code like this. If you do and it is intentional, convert it to React.createRef() instead: class ClassWithRenderProp extends React.Component { myRef = React.createRef(); componentDidMount() { doSomething(this.myRef.current); } render() { return this.props.children(this.myRef); } } class ClassParent extends React.Component { render() { return ( <ClassWithRenderProp> {myRef => <Button ref={myRef} />} </ClassWithRenderProp> ); } } Note To see this warning, you need to have the babel-plugin-transform-react-jsx-self installed in your Babel plugins. It must only be enabled in development mode. If you use Create React App or have the “react” preset with Babel 7+, you already have this plugin installed by default. Deprecating React.createFactory React.createFactory is a legacy helper for creating React elements. This release adds a deprecation warning to the method. It will be removed in a future major version. Replace usages of React.createFactory with regular JSX. Alternately, you can copy and paste this one-line helper or publish it as a library: let createFactory = type => React.createElement.bind(null, type); It does exactly the same thing. Deprecating ReactDOM.unstable_createPortal in favor of ReactDOM.createPortal When React 16 was released, createPortal became an officially supported API. However, we kept unstable_createPortal as a supported alias to keep the few libraries that adopted it working. We are now deprecating the unstable alias. Use createPortal directly instead of unstable_createPortal. It has exactly the same signature. Other Improvements Component stacks in hydration warnings React adds component stacks to its development warnings, enabling developers to isolate bugs and debug their programs. This release adds component stacks to a number of development warnings that didn’t previously have them. As an example, consider this hydration warning from the previous versions: While it’s pointing out an error with the code, it’s not clear where the error exists, and what to do next. This release adds a component stack to this warning, which makes it look like this: This makes it clear where the problem is, and lets you locate and fix the bug faster. Notable bugfixes This release contains a few other notable improvements: In Strict Development Mode, React calls lifecycle methods twice to flush out any possible unwanted side effects. This release adds that behaviour to shouldComponentUpdate. This shouldn’t affect most code, unless you have side effects in shouldComponentUpdate. To fix this, move the code with side effects into componentDidUpdate. In Strict Development Mode, the warnings for usage of the legacy context API didn’t include the stack for the component that triggered the warning. This release adds the missing stack to the warning. onMouseEnter now doesn’t trigger on disabled <button> elements. ReactDOM was missing a version export since we published v16. This release adds it back. We don’t recommend using it in your application logic, but it’s useful when debugging issues with mismatching / multiple versions of ReactDOM on the same page. We’re thankful to all the contributors who helped surface and fix these and other issues. You can find the full changelog below. Installation React React v16.13.0 is available on the npm registry. To install React 16 with Yarn, run: yarn add react@^16.13.0 react-dom@^16.13.0 To install React 16 with npm, run: npm install --save react@^16.13.0 react-dom@^16.13.0 We also provide UMD builds of React via a CDN: <script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script> <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script> Refer to the documentation for detailed installation instructions. Changelog React Warn when a string ref is used in a manner that’s not amenable to a future codemod (@lunaruan in #17864) Deprecate React.createFactory() (@trueadm in #17878) React DOM Warn when changes in style may cause an unexpected collision (@sophiebits in #14181, #18002) Warn when a function component is updated during another component’s render phase (@acdlite in #17099) Deprecate unstable_createPortal (@trueadm in #17880) Fix onMouseEnter being fired on disabled buttons (@AlfredoGJ in #17675) Call shouldComponentUpdate twice when developing in StrictMode (@bvaughn in #17942) Add version property to ReactDOM (@ealush in #15780) Don’t call toString() of dangerouslySetInnerHTML (@sebmarkbage in #17773) Show component stacks in more warnings (@gaearon in #17922, #17586) Concurrent Mode (Experimental) Warn for problematic usages of ReactDOM.createRoot() (@trueadm in #17937) Remove ReactDOM.createRoot() callback params and added warnings on usage (@bvaughn in #17916) Don’t group Idle/Offscreen work with other work (@sebmarkbage in #17456) Adjust SuspenseList CPU bound heuristic (@sebmarkbage in #17455) Add missing event plugin priorities (@trueadm in #17914) Fix isPending only being true when transitioning from inside an input event (@acdlite in #17382) Fix React.memo components dropping updates when interrupted by a higher priority update (@acdlite in #18091) Don’t warn when suspending at the wrong priority (@gaearon in #17971) Fix a bug with rebasing updates (@acdlite and @sebmarkbage in #17560, #17510, #17483, #17480) Full Article
react React Router & Webpack in Production By reactjsnews.com Published On :: Sun, 13 Mar 2016 04:00:09 +0000 I’ve been working on a pretty large react-router codebase at work. Currently it has around 50~ code splits, which as you can imagine, is a lot of routes. This is going to be a post on the things I’ve learned throughout building out my development / production config and how we are using webpack in production. ###Initial Setup Before I really dive into how my webpack config is setup and the problems I’ve found, I’ll quickly go over how this app is setup. Currently, there’s one entry point and it looks like this: import React from 'react' import { render } from 'react-dom' import { match, Router, browserHistory } from 'react-router' import AsyncProps from 'async-props' import routes from '../routes/index' /* globals document, window */ const { pathname, search, hash } = window.location const location = `${pathname}${search}${hash}` match({ routes, location }, () => { render( <Router render={props => <AsyncProps {...props}/>} routes={routes} history={browserHistory} />, document.getElementById('app') ) }) It looks like a standard react-router setup, except a couple things are different. For one, there’s way too many routes to have them all in this file, so we are importing the main route object into this file. Second, we are using match on the client side. Without matching first, the client side would try to render before the splits were downloaded causing an error. You can read a little more about match on the client here. Next, we are using Ryan Florence’s awesome async-props library for loading data into components. It allows me to load data from an api before the server renders components. It will pass the data down to the client for the client-side render, and then data will load as you navigate to new pages automatically. ###Routes Our main routes file looks like this: export default { component: 'div', path: '/', indexRoute: require('./index'), childRoutes: [ require('./login'), require('./account'), ... ] } There’s a lot more require’s in our app of course. And these are nested pretty deep. The files referenced in the root file have more child routes, and those use require.ensure which you can read about in the webpack docs on code splitting. It tells webpack to make a new bundle, and then load that bundle when require.ensure is called on the client. Here’s an example: if(typeof require.ensure !== "function") require.ensure = function(d, c) { c(require) } module.exports = { path: 'account', getComponent(location, cb) { require.ensure([], (require) => { cb(null, require('../../views/master/index.jsx')) }) }, childRoutes: [ require('./settings'), ] } There’s a few things going on here. First, we have a function at the top that will polyfill require.ensure. Why? Well, on this project we are server rendering our whole site as well, which I would rather not do, but due to the type of site we are building: we have to. The next thing is the relative require path. I’m using this awesome babel resolver plugin along with webpack’s resolve paths so that I can import files like this: import Header from '../../master/header' //becomes import Header from 'master/header' Why do I have to use a babel plugin AND webpack’s resolve feature? Once again, doing a server rendered app, the code is ran on the server and also through webpack. In this particular app, I haven’t had time to experiment with webpacking the server. Anyways, if I didn’t use the babel plugin, errors would be thrown on the server, but webpack would work fine. This is one of the common things I have ran into while building this app. Realizing some things need to be done slightly different on the server or client. You may still be wondering why I am referencing the component as a relative path in the above route example, and that’s because the babel plugin I’m using only works with import and not require. My route objects are the one place that I have these “nasty” looking paths. ##Webpack I was prompted to make this article after tweeting this out: webpack splits vs AggressiveMergingPlugin({minSizeReduce: 1.0}) pic.twitter.com/b6kxHEqNcO— ReactJS News (@ReactJSNews) March 10, 2016 A couple people wanted a better explanation as to what’s happening here. When I was first building my production webpack config, even after using all of these plugins: new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js'), new webpack.optimize.OccurenceOrderPlugin(), new webpack.optimize.DedupePlugin(), new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false }, comments: false, sourceMap: false, mangle: true, minimize: true }), My bundle looked like this: That’s pretty huge if you think about it. And I’m not talking about the amount of bundles. I’m talking about the file size. After searching everywhere for a solution to get the bundle size down further, I found webpack’s AggressiveMergingPlugin. This thing is a life saver. As you may have seen from the tweet, the output turns into this: Just having the main, vendor, and one other bundle brings the whole site under 1MB. I’m using the plugin to only merge files if the size reduction is more than 50%, which is the default. People talk about code splitting in webpack and think it’s really amazing to load the JS for the page you’re on and nothing more. It sounds great. The problem is that the file size is immensely bigger. If someone more familiar with webpack has a better idea as to why this is, I’d like a better explanation. It isn’t feasable to keep the splits instead of merging them. This site is pretty large, with a lot of routes as you can tell from the screenshots. Codesplitting without merging would cause way more waiting on the client side every time you navigate to a new page. Even if the JS was heavily cached, the first time you hit these pages it will have to load a 300kb bundle for some of them. ##Caching That takes us to caching. We are about a month away from publicly launching this site, so we haven’t setup the workflow for pushing updates through a cdn, but that will be the end result. For now, in my webpack config, my output object looks like this: output: { path: __dirname + '/public/assets/js/[hash]/', filename: '[name].js', chunkFilename: '[id].js', publicPath: '/assets/js/[hash]/' }, This is in the production config of course. This way I can cache the files and when I update the code, the hash will change and the browser won’t be caching the old code. I pass in the hash as an env variable at runtime to that the server has the correct path to the assets folder. ##Problems There were a few big problems I came across while building out a server rendered app with dynamic routes. The first was page titles. How am I supposed to have the right title on the client and on the initial server render? Thankfully, Ryan has yet another solution. react-title-component solves this perfectly. The next was, how do I hit an api, wait for the response on server render, load new data on route changes, and of course, do this at the component level. As I mentioned before, async-props solves this problem too. It will give you route info so that you can make requests based on things in the url. The next problem is one that I haven’t fully solved. Webpack is getting really slow. It takes around 20 seconds on a maxed out macbook 15” to build code in production. On the server, it takes more like a minute! If I’m in development mode, it takes around 10 seconds to make the initial build, and sometimes it lags on building the splits on code change. If anyone has insight into this I would love to hear it. This one goes along with the webpack one, and it is reloading the server. I haven’t tried to webpack the server but I hear doing so works great for this. I don’t think it would fix the problem with webpack being slow though, and in fact it would probably make it even slower. ##Folder structure I almost forgot to throw this one in here! I’m really happy with the structure of this project. I have a views folder that has all of the same folders and file names as the routes folder. It makes it really easy to find things. These also correspond with the URL to the page. /account/settings will be in views/account/settings.jsx and routes/account/settings.js. The same is true for my tests folder. ##Conclusion I hope this gave you a good glimpse at how webpack and react router work at a larger scale than you see most blog posts cover. If you have any questions or things that you would like me to talk about that I haven’t already, please leave a comment below and I will update this post! I’m sure that I forgot a few problems and tips writing this. I was thinking this would be a short post but it blew up on me! Full Article
react How to Make Your React Apps 15x Faster By reactjsnews.com Published On :: Thu, 07 Apr 2016 17:00:00 +0000 Without any modifications, React is really fast as-is. There are, however, a few things that you can do to improve performance. While working at HelloSign, I discovered some quick fixes that made our apps incredibly snappy. With these simple changes, I was able to reduce render time from over 3000 milliseconds to less than 200 milliseconds. Without any modifications, React is really fast as-is. There are, however, a few things that you can do to improve performance. While working at HelloSign, I discovered some quick fixes that made our apps incredibly snappy. With these simple changes, I was able to reduce render time from over 3000 milliseconds to less than 200 milliseconds. Editor’s Note: Check out our upcoming React University Workshops. Our next workshop, React 2016, will be held on April 23 at Microsoft Reactor in San Francisco and will offer a deep dive into creating modern Single-Page Applications (SPA) using React, Redux, React Router, Immutable.js, and Webpack. Also, if you’re interested in learning the basics about what it takes to be a Data Visualization Engineer, check out React and D3. Introduction HelloSign is a cloud-based electronic signature tool founded in 2010. As you can imagine, HelloSign is a very JavaScript-heavy codebase. A lot of client-side behavior is necessary to create a rich signing experience. Lately, we’ve moved much of our codebase toward React. In fact, in many places we’ve broken up our codebase into several single-page applications written in React. Although the HelloSign team was happy with React’s performance before I initially joined the project, I quickly found some low-hanging fruit that could improve runtime speed. Here are the steps you should take to see similar improvements in your own applications. Create a Baseline Performance Measurement Before you begin, you should take a baseline measurement. Optimizations are meaningless if you can’t verify the results of your modifications. Thankfully, Chrome has excellent developer tools to help. One, little-used feature of Chrome’s DevTools is the “Timeline” tool. It allows you to record and analyze all activity in your application. You can record interactions on the page, locate potential memory leaks, measure the total time it takes to perform a task, and identify areas of potential jank. Best of all, the results can be recorded for comparison with your final benchmark. There’s actually a really awesome video on Chrome’s DevTools that goes into detail about the “Timeline” feature. You can view it here. We chose to measure the time elapsed between the initial paint of our signer page to the final rendering of the entire page. The initial download of our bundles still needs some optimization, but we’re neither going to mess with nor measure this parameter. It’s fairly easy and consistent to test render time rather than trying to click areas around the page and trying to measure its performance in a repeatable way. Then, all we needed to do was to go to the signer page, open Chrome’s DevTools “Timeline” tab, and refresh the page. As a side note, make sure that when performing this test, the “Paint” and “Screenshots” boxes are checked so that you can see what the user sees as the page is being rendered. After all that, we determined that our rendering time from initial paint was a little over 3 seconds. Much too long. Luckily, there was little we had to do to make this quite a bit faster. Set NODE_ENV to Production This step is easy to get wrong, even if you are well-informed. React’s documentation provides an overview, but doesn’t provide many specifics. React has great developer warnings and error checking, but these are only intended for development; if you take a look at React’s source code, you’ll see a lot of if (process.env.NODE_ENV != 'production') checks. This is running extra code that is not needed by the end user, not to mention that calling process.env.NODE_ENV is extremely slow. For production environments, we can remove all this unnecessary code. Just keep in mind that you don’t want to do this in development because it will remove all those helpful developer warnings. If you’re using Webpack, you can use DefinePlugin to replace all instances of process.env.NODE_ENV with 'production', and then use the UglifyJsPlugin to remove all the dead code that no longer runs. Here’s a sample setup that you might use: // webpack.config.js ... plugins: [ new webpack.DefinePlugin({ // A common mistake is not stringifying the "production" string. 'process.env.NODE_ENV': JSON.stringify('production') }), new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }) ] ... React Constant and Inline Elements Transforms React 0.14 introduced support for certain transpile time optimizations with Constant and Inline Element Babel Transforms. React Constant Elements treats JSX elements as values and hoists them to a higher scope. In other words, it hoists static elements and thereby reduces calls to React.createClass. React Inline Elements converts JSX elements into the object literals that they eventually return. Again, this minimizes the runtime calls to React.createClass. The implementation is rather simple. We added our Babel configuration in our package.json file: // package.json ... "babel": { "env": { "production": { "plugins": [ "transform-react-constant-elements", "transform-react-inline-elements" ] } } }, ... Final Measurement / Conclusion Lastly, you’ll want to run the benchmark again and compare it with that saved benchmark from before these optimizations. As you can see, the total runtime profile ends 200ms after initial paint! That’s 15 times faster! Full Article
react Playing With React and D3 By reactjsnews.com Published On :: Thu, 21 Apr 2016 17:00:00 +0000 D3 is great at data visualizations, but it manipulates the DOM directly to display that data. Rendering DOM elements is where React shines. It uses a virtual representation of the DOM (virtual DOM) and a super performant diffing algorithm in order to determine the fastest way to update the DOM. We want to leverage React’s highly efficient, declarative, and reusable components with D3’s data utility functions. At this point, we can safely say that React is the preferred JavaScript library for building user interfaces. It is used practically everywhere and is almost as pervasive as jQuery. It has an API that is simple, powerful, and easy to learn. Its performance metrics are really impressive thanks to the Virtual DOM and its clever diff algorithm between state changes. Nothing, however, is perfect, and React too has its limitations. One of React’s greatest strengths is the ease with which it integrate third-party libraries, but some libraries, especially opinionated ones, are more difficult to integrate than others. An extremely popular library that can be tricky to integrate with React is D3.js. D3 is an excellent data visualization library with a rich and powerful API. It is the gold standard of data visualizations. However, Because this library is opinionated about data, it is no trivial endeavour to get it to work with React. A few simple strategies permit these two libraries to work together in very powerful ways. Editor’s Note: Check out our upcoming workshop, React and D3, a crash course in learning how to create data visualizations with these two in demand libraries. Reserve your spot now on Eventbrite and get 20% off admission. Learn more at the Eventbrite page What is React? React is an open-source JavaScript library for creating user interfaces that addresses the challenges of building large applications with data that changes over time. Originally developed at Facebook, it is now seen in many of the most commonly used web applications including Instagram, Netflix, Airbnb, and HelloSign. Why is React so popular? React helps developers build applications by helping manage the application state. It’s simple, declarative, and composable. React is not a traditional MVC framework because React is really only interested in building user interfaces. Some have called it the “V(iew)” in MVC, but that’s a little misleading. React’s viewpoint is different. As application logic has reoriented toward the client, developers have applied more structure to their front-end JavaScript. We applied a paradigm that we already understood from the server (MVC) to the browser. Of course, the browser environment is very different from the server. React acknowledges that client-side applications are really a collection of UI components that should react to events like user interaction. React encourages the building applications out of self-contained, reusable components that only care about a small piece of the UI. Other frameworks such as Angular also attempt to do this, but React stands out because it enforces a unidirectional data flow from parent component to child component. This makes debugging much easier. Debugging is the hardest part of application development, so while React is more verbose that other libraries or frameworks, in the end it saves a lot of time. In a framework like Angular’s, it can be hard to figure out where a bug is coming from: The view? The model? The controller? The directive? The directive controller? Data in Angular flows in many different directions, and this makes it hard to reason about that state of your application. In React, when there is a bug (and there will be!), you can quickly determine where the bug originated from because data only moves in one direction. Locating a bug is as simple as connecting the numbered dots until you find the culprit. What is D3? D3 (Data-Driven Documents) is a JavaScript library for producing dynamic, interactive data-visualizations. It’s fairly low level, and the developer has a lot of control over the end result. It takes a bit of work to get D3 to do what you want, so if you’re looking for a more prepackaged solution, you’re probably better off with highcharts.js. That said, it is fairly simple to pick up once you get the hang of it. D3 does four main things: LOADS: D3 has convenient methods for importing data from CSV documents. BINDS: D3 binds data elements to the DOM via JavaScript and SVG. TRANSFORMS: data can be adjusted to fit your visual requirements TRANSITIONS: D3 can respond to user input and animate elements based on that input Why Would We Want To Use React with D3? D3 is great at data visualizations, but it manipulates the DOM directly to display that data. Rendering DOM elements is where React shines. It uses a virtual representation of the DOM (virtual DOM) and a super performant diffing algorithm in order to determine the fastest way to update the DOM. We want to leverage React’s highly efficient, declarative, and reusable components with D3’s data utility functions. Also, once we create a chart component, we can want to be able to reuse that chart with different data anywhere in our app. How to use React and D3? D3, like React, is declarative.D3 uses data binding, whereas React uses a unidirectional data flow paradigm. Getting these two libraries to work together takes a bit of work, but the strategy is fairly simple: since SVG lives in the DOM, let React handle displaying SVG representations of the data and lett D3 handle all the math to render the data. Of course, we’ll have to make compromises. React is unopinionated and flexible, thereby allowing you to accomplish whatever needs to be done. Some tasks, like creating axes, are tedious. We can let D3 directly access the DOM and create. It handles axes well, and since we only need to create very few, this tactic won’t affect performance. Let’s go through a simple example. I created a repository you can use to follow along here: playing-with-react-and-d3. You can follow in the unfinished directory and if you get stuck you can take a look at the finished directory. Let’s generate a random list of X-Y coordinates and display them on a ScatterPlot chart. If you’re following the tutorial, a finished example is provided for you under the “finished” directory, but you can also follow along under “unfinished.” I’ve gone through the trouble of doing all the setup for you. The build will automatically be created from “unfinished/src/index.jsx” Let’s start by creating a simple “Hello World!” React component. Create a file under “components” named “chart.jsx” // unfinished/src/components/chart.jsx import React from 'react'; export default (props) => { return <h1>Hello, World!</h1>; } This example is simple, but let’s go over the explanation anyway. Since we’re rendering a simple H1 with no state, we can just export a function that returns the HTML we expect. If you’re familiar with Angular or Ember, it might look weird to insert HTML directly into our JS code. On the one hand, this goes against everything we’ve learned about unobtrusive JavaScript. But on the other hand, it actually makes sense: we’re not putting JavaScript in our HTML, we’re putting our HTML into our JavaScript. React sees HTML and client-side JavaScript as fundamentally bonded together. They’re both concerned about one thing – rendering UI components to the user. They simply cannot be separated without losing the ability to see what your component is going at a glance. The great benefits of this approach is that you can describe exactly what your component will look like when it’s rendered. Also, keep in mind that this is only possible with JSX, which translates HTML elements into React functions that will render the HTML to the page. Now, let’s move on and mount our component to the DOM. Open up “index.jsx” // unfinished/src/index.jsx import './main.css'; import React from 'react'; import ReactDOM from 'react-dom'; import Chart from './components/chart.jsx'; const mountingPoint = document.createElement('div'); mountingPoint.className = 'react-app'; document.body.appendChild(mountingPoint); ReactDOM.render(<Chart/>, mountingPoint); You probably noticed a few things. You might be wondering why we’re requiring a CSS file. We’re using Webpack, which allows us to require CSS files. This is very useful when we modularize both our stylesheets and our JavaScript. We’re also creating a div in which we want to mount our React app. This is just a good practice in case you want to do other things on the page then render a React component. Lastly, we’re calling render on ReactDOM with 2 arguments, the name of the component and the DOM element we want to mount it on. Now, let’s install all the dependencies by navigating to the unfinished directory and running npm i. Then, fire up the server with npm run start and go to localhost:8080 Awesome! We have rendered our first React component! Let’s do something a little less trivial now. Let’s compose some functions that will create an array of random data points and then render a scatter plot. While we’re at it, we’ll add a button to randomize the dataset and trigger a re-render of our app. Let’s open up our Chart component and add the following: // unfinished/src/components/chart.jsx import React from 'react'; import ScatterPlot from './scatter-plot'; const styles = { width : 500, height : 300, padding : 30, }; // The number of data points for the chart. const numDataPoints = 50; // A function that returns a random number from 0 to 1000 const randomNum = () => Math.floor(Math.random() * 1000); // A function that creates an array of 50 elements of (x, y) coordinates. const randomDataSet = () => { return Array.apply(null, {length: numDataPoints}).map(() => [randomNum(), randomNum()]); } export default class Chart extends React.Component{ constructor(props) { super(props); this.state = { data: randomDataSet() }; } randomizeData() { this.setState({ data: randomDataSet() }); } render() { return <div> <h1>Playing With React and D3</h1> <ScatterPlot {...this.state} {...styles} /> <div className="controls"> <button className="btn randomize" onClick={() => this.randomizeData()}> Randomize Data </button> </div> </div> } } Since we want our component to manage it’s own state, we need to add a bit more code than was necessary for our previous “Hello World” stateless functional component. Instead of just a function, we’re going to extend React.Component and describe our component in the render() method. render() is the heart of any React component. It describes what our component is supposed to looks like. React will call render() on initial mount and on every state change. Inside of render(), we are both rendering a scatter plot component as if it were an HTML element and setting some properties or “props”. The ... syntax is a convenient JSX and ES2015 spread operator that spreads the attributes of an array or object instead of doing all of that explicitly. For more information check out: JSX Spread Attributes. We’re going to use render() to pass our data and a style object that will be used by some of our child components. In addition, we’re also rendering a button with an onClick event handler. We’re going to wrap this.randomizeData() with an arrow function and bind the value of this to our Chart component. When the button is clicked, randomizeData() will call this.setState() and pass in some new data. Let’s talk about this.setState(). If render() is the heart of a React component, setState() is the brains of a component. setState explicitly tells React that we’re changing the state, thereby triggering a re-render of the component and its children. This essentially turns UI components into state machines. Inside of setState(), we’re passing an object with data set to the randomDataSet(). This means that if we want to retrieve the state of our application, we need only call this.state.whateverStateWereLookingFor. In this case, we can retrieve the randomData by calling this.state.data. A little side note on how React works: React offers great performance for rendering UI components by implementing a diff algorithm and comparing a virtual DOM in memory with the actual DOM. When you think about it, the DOM is really a large tree structure. If there’s one thing we have learned from decades of computer science research, it’s how to compare and manipulate trees. React takes advantage of clever tree diffing algorithms, but in order to work, each component can only render one parent element (i.e., you cannot render sibling elements). That’s why In the render function we’re wrapping all our elements in one parent div. Let’s get started with the scatter plot component. Create a file unfinished/src/components/scatter-plot.jsx : // unfinished/src/components/scatter-plot.jsx import React from 'react'; import d3 from 'd3'; import DataCircles from './data-circles'; // Returns the largest X coordinate from the data set const xMax = (data) => d3.max(data, (d) => d[0]); // Returns the highest Y coordinate from the data set const yMax = (data) => d3.max(data, (d) => d[1]); // Returns a function that "scales" X coordinates from the data to fit the chart const xScale = (props) => { return d3.scale.linear() .domain([0, xMax(props.data)]) .range([props.padding, props.width - props.padding * 2]); }; // Returns a function that "scales" Y coordinates from the data to fit the chart const yScale = (props) => { return d3.scale.linear() .domain([0, yMax(props.data)]) .range([props.height - props.padding, props.padding]); }; export default (props) => { const scales = { xScale: xScale(props), yScale: yScale(props) }; return <svg width={props.width} height={props.height}> <DataCircles {...props} {...scales} /> </svg> } There’s a lot going on here, so let’s start with the stateless functional component that we’re exporting. D3 uses SVG to render data visualizations. D3 has special methods for creating SVG elements and binding data to those elements – but we’re going to let React handle that. We’re creating an SVG element with the properties passed in by the Chart component and which can be accessed via this.props. Then we’re creating a DataCircles component (more on that below) which will render the points for the scatter plot. Let’s talk about D3 scales. This is where D3 shines. Scales takes care of the messy math involved in converting your data into a format that can be displayed on a chart. If you have a data point value 189281, but your chart is only 200 pixels wide, then D3 scales converts that value to a number you can use. d3.scale.linear() returns a linear scale. D3 also supports other types of scales (ordinal, logarithmic, square root, etc.), but we won’t be talking about those here. domain is short for an “input domain”, i.e., the range of possible input values. It takes an array of the smallest input value possible and the maximum input value. range on its own is the range of possible output values. So in domain, we’re setting the range of possible data values from our random data, and in range we’re telling D3 the range of our chart. d3.max is a D3 method for determining the maximum value of a dataset. It can take a function which D3 will use to give the max values of the X and Y coordinates. We use the scales to render the data circles and our axes. Let’s create the DataCircles component under unfinished/src/components/data-circles.jsx // unfinished/src/components/data-circles.jsx import React from 'react'; const renderCircles = (props) => { return (coords, index) => { const circleProps = { cx: props.xScale(coords[0]), cy: props.yScale(coords[1]), r: 2, key: index }; return <circle {...circleProps} />; }; }; export default (props) => { return <g>{ props.data.map(renderCircles(props)) }</g> } In this component, we’re rendering a g element, the SVG equivalent to a div. Since we want to render a point for every set of X-Y coordinates, were must render multiple sibling elements which we wrap together in a g element for React to work. Inside of g, we’re mapping over the data and rendering a circle for each one using renderCircles. renderCircles creates an SVG circle element with a number of properties. Here’s where we’re setting the x and y coordinates (cx and cy respectively) with the D3 scales passed in from the scatter plot component. r is the radius of our circle, and key is something React requires us to do. Since we’re rendering identical sibling components, React’s diffing algorithm needs a way to keep track of them as it updates the DOM over and over. You can use any key you like, as long as it’s unique to the list. Here we’re just going to use the index of each element. Now, when we look at our browser, we see this: We can see our random data and randomize that data via user input. Awesome! But we’re missing a way to read this data. What we need are axes. Let’s create them now. Let’s open up ScatterPlot.jsx and add an XYAxis component // unfinished/src/components/scatter-plot.jsx // ... import XYAxis from './x-y-axis'; // ... export default (props) => { const scales = { xScale: xScale(props), yScale: yScale(props) }; return <svg width={props.width} height={props.height}> <DataCircles {...props} {...scales} /> <XYAxis {...props} {...scales} /> </svg> } Now, let’s create the XYAxis component; // unfinished/src/components/x-y-axis.jsx import React from 'react'; import Axis from './axis'; export default (props) => { const xSettings = { translate: `translate(0, ${props.height - props.padding})`, scale: props.xScale, orient: 'bottom' }; const ySettings = { translate: `translate(${props.padding}, 0)`, scale: props.yScale, orient: 'left' }; return <g className="xy-axis"> <Axis {...xSettings}/> <Axis {...ySettings}/> </g> } For simplicity’s sake, we’re creating two objects which will hold the props for each of our X-Y axes. Let’s create an axis component to explain what these props do. Go ahead and create axis.jsx // unfinished/src/components/x-y-axis.jsx import React from 'react'; import d3 from 'd3'; export default class Axis extends React.Component { componentDidMount() { this.renderAxis(); } componentDidUpdate() { this.renderAxis(); } renderAxis() { var node = this.refs.axis; var axis = d3.svg.axis().orient(this.props.orient).ticks(5).scale(this.props.scale); d3.select(node).call(axis); } render() { return <g className="axis" ref="axis" transform={this.props.translate}></g> } } Our strategy up to this point has been to let React exclusively handle the DOM. This is a good general rule, but we should leave room for nuance. In this case, the math and work necessary in order to render an axis is quite complicated and D3 has abstracted that pretty nicely. We’re going to let D3 have access to the DOM in this case. And since we’re only going to render a ma Full Article
react Routing in React Native with Jake Murzy By reactjsnews.com Published On :: Wed, 28 Sep 2016 17:00:00 +0000 Jake Murzy has been hard at work creating a new navigational library for React Native over the last couple of months. While React JS has the benefit of the highly-regarded React Router, such a comprehensive routing solution doesn’t exist yet in the React Native community. In fact, React Native’s routing landscape has been in constant upheaval for the last year. The library itself has official three ‘navigators’ for handling decision making on which components to show the user, including ‘NavigatorIOS’, ‘Navigator’, and - more recently - ‘NavigatorExperimental’. The open source community likewise has the packages ‘React Native Router Flux’, ‘React Native Router Native’, and ‘React Native Redux Router’, which of which are in various states of completion, or, more commonly, disrepair. Jake Murzy has been hard at work creating a new navigational library for React Native over the last couple of months. While React JS has the benefit of the highly-regarded React Router, such a comprehensive routing solution doesn’t exist yet in the React Native community. In fact, React Native’s routing landscape has been in constant upheaval for the last year. The library itself has official three ‘navigators’ for handling decision making on which components to show the user, including ‘NavigatorIOS’, ‘Navigator’, and - more recently - ‘NavigatorExperimental’. The open source community likewise has the packages ‘React Native Router Flux’, ‘React Native Router Native’, and ‘React Native Redux Router’, which of which are in various states of completion, or, more commonly, disrepair. React Router Native appears to focus on matching the API of the immensely popular React Router package, even going as far as introducing the concept of a URL into React Native, which bucks the notion that only web applications need or deserve a URL. Today Jake is going to share some of his thoughts about his new library. Q: Hi Jake! The React Native library contains several navigation solutions and the surrounding ecosystem has multiple routing libraries. What made you decide to make your own? Hey! Thanks for reaching out. I’ve been eagerly watching what’s happening with navigation on React Native for a while. Until very recently, the whole Navigation scene in React Native was a mess. Navigator was being deprecated in favor of NavigationExperimental and NavigationExperimental wasn’t ready for prime time. My team was just starting a new project so I tried quite a few of the available solutions. Having successfully used React Router on the web, we were looking for a similar solution. Unfortunately, React Router did not support React Native, and other solutions we found were either very unstable, had a hard time keeping up with upstream changes on each release or the quality of code was quite poor. NavigationExperimental did most of what we wanted but it was a bit too low level so often times we found ourselves writing navigation related code and you can imagine how this gets tedious fast. The low level nature of NavigationExperimental is really by design to allow abstractions to be built up in higher layers. So to finally answer your question, the project came directly out of my frustration trying to make navigation work on React Native as good as React Router did on the web. Q: What is the strength of your routing system? Is there any type of app that would be a perfect fit with React Router Native? Conversely, is there any type of app that wouldn’t be a good fit with the library? The use cases for React Router Native is pretty much the same as NavigationExperimental—which is the only supported navigation library by the React Native team. React Router Native is a very thin layer on top of NavigationExperimental that offers React Router’s mental model in a native app. Under the hood, it uses React Router for routing and NavigationExperimental for rendering user components. This is a very powerful combination that makes URLs possible on mobile. Most apps do not have deep-linking capabilities because implementing it for each screen in your app is a challenging task. Even within apps, users are often forced to take screenshots to share information. And for many, it’s vital that their apps support deep-linking. For example, Yelp goes as far to show a share prompt when users take screenshots of business listings. React Router Native enables developers to implement deep-linking in their apps without putting forth much effort. This can pave the way for a more connected app ecosystem. That being said, we’re still in the early days of React Native figuring out the right abstractions. Navigation on mobile is a challenging task, and having different flavors is only healthier as the community weighs the pros and cons of each approach rather than second guessing best-practices. So I’m hoping to get the community involved to shape the direction of the project. Q: Is React Router Native designed to be used with any of the official Navigation components written by the React Native team? Absolutely. One of the primary goals of the project is that we follow React’s “learn once, write anywhere” principle. So you can use the community maintained components, interpolators and pan responders from React Native, and everything is highly customizable if you need instruct NavigationExperimental to do fancy transition animations, etc. Q: The React Router team has somewhat famously rewritten their API several times in the last two years, each time introducing several breaking changes. Do you hope to keep your library at parity with React Router, breaking changes and all? Case in point, the V4 release of React Router will introduce an all-new API. React Router v4 is a complete rewrite. There was a lot of head-scratching on Twitter over the entire new set of breaking changes. Many people thought v4 should at best have been released under a different name. I’m not sure if I agree with that sentiment though, I understand where it is coming from. React Router v4 is a preview release, and in my opinion, it’s really hard to argue against replacing a foreign API with simple React components. I do hope to keep the library at parity with React Router, and to be honest, v4’s new everything-is-a-component approach makes the integration even easier. So over the next few weeks I’ll be working on v4 support. Q: If you were new to React Native, which routing solution would you use? Why? This is a hard one to answer. Eric Vicenti has done a great job on NavigationExperimental and most of the issues have been sorted out by the community over the last few months. So if you’re familiar with Redux concepts and comfortable writing your own reducers to manage navigation state, NavigationExperimental is a great choice. One that I’m surprised you didn’t mention that deserves more attention is ExNavigation—another fairly new addition to the brewery. It also uses NavigationExperimental and is maintained by Adam Miskiewicz, Brent Vatne and other awesome members of the Exponent community. It feels a bit tied to the Exponent platform, but runs perfectly fine on React Native and is open source. So you’ve got that. Finally, If you’re just getting started with React Native and all you need is to be able to click a button and have it transition to a different scene but you don’t want it to get in your way when you need to reach in and apply complex navigational patterns, I strongly recommend you take React Router Native for a spin. Full Article
react Leveraging React for Easy Image Management By reactjsnews.com Published On :: Tue, 17 Jan 2017 17:00:00 +0000 React is a good tool when it comes to building flexible and reusable UI components. However, it’s “one of those libraries” that cannot handle all the tasks involved in building a full fleshed UI project. Other supporting tools - such as a recently announced React SDK from Cloudinary - are available to provide solutions that the React core cannot. In such cases where media (images and videos) becomes a heavy task to handle, Cloudinary simplifies the process with the new React SDK. Let’s build and image library with Cloudinary and React using the Cloudinary’s React SDK. Prerequisites The only requirements for using Cloudinary in your existing React project are to install the React SDK and the upload widget. If you do not have an existing React project and want to try these examples, take the following steps: 1. Install Dependencies We need a minimal amount of dependencies so we can focus on building a media library and not structuring a React app: { "name": "img-library", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "watch": "webpack -d --watch", "build": "webpack", "serve": "serve ./public" }, "author": "", "license": "MIT", "devDependencies": { "babel-core": "^6.18.2", "babel-loader": "^6.2.9", "babel-preset-es2015": "^6.18.0", "babel-preset-react": "^6.16.0", "serve": "^1.4.0", "webpack": "^1.14.0" }, "dependencies": { "axios": "^0.15.3", "cloudinary-react": "^1.0.1", "react": "^15.4.1", "react-dom": "^15.4.1" } } React (and React DOM) must be used since we are making a React app. The cloudinary-react dependency is Cloudinary’s React SDK, which we will soon see how it works. axios is a tool for making HTTP requests and, in our case, we will use it request images from the Cloudinary server. # Install dependencies npm install 2. Setup Webpack Webpack is our build tool. Only minimal settings are required to have a build running and our React app compiling: // ./webpack.config.js var webpack = require('webpack'); var path = require('path'); var BUILD_DIR = path.resolve(__dirname, 'public'); var APP_DIR = path.resolve(__dirname, 'src'); var config = { entry: APP_DIR + '/index.jsx', output: { path: BUILD_DIR, filename: 'bundle.js' }, module : { loaders : [ { test : /.jsx?/, include : APP_DIR, loader : 'babel' } ] } }; module.exports = config; Basic configuration - an entry, output and loaders to handle the React .jsx files. 3. Entry Points We need to create an entry point, as we specified in the Webpack configuration, and another entry point for the browser, which is an index.html file: // ./src/index.jsx import React, { Component } from 'react'; import { render } from 'react-dom'; class Main extends Component { render() { return ( <div className="main"> <h1>Scotchage</h1> </div> ); } } render(<Main />, document.getElementById('container')); <!-- ./public/index.html --> <html> <head> <!--Stylesheet--> <link rel="stylesheet" href="style.css"> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <!--Container for React rendering--> <div id="container"></div> <!--Bundled file--> <script src="bundle.js"></script> </body> </html> 4. Create Cloudinary Account You need a Cloudinary account to continue with these examples. Sign up for free and store your credentials safely as shown on the dashboard: Uploading Images Before using the React SDK to deliver images from the Cloudinary servers, let’s use the awesome Cloudinary upload widget to upload images. First, we need to add this widget to our index.html: <!-- ./public/index.html --> <html> <head> . . . </head> <body> . . . <!-- UPLOAD WIDGET --> <script src="//widget.cloudinary.com/global/all.js" type="text/javascript"></script> <script src="bundle.js"></script> </body> </html> Next, we create a button, attach an event to it and upload an image once the button is clicked: import React, { Component } from 'react'; import { render } from 'react-dom'; class Main extends Component { uploadWidget() { cloudinary.openUploadWidget({ cloud_name: 'CLOUD_NAME', upload_preset: 'PRESET', tags:['xmas']}, function(error, result) { console.log(result); }); } render(){ return ( <div className="main"> <h1>Galleria</h1> <div className="upload"> <button onClick={this.uploadWidget.bind(this)} className="upload-button"> Add Image </button> </div> </div> ); } } render(<Main />, document.getElementById('container')); The uploadWidget member method is the handler invoked by the click event to handle our image upload by calling cloudinary.openUploadWidget. openUploadWidget takes a config object and the upload callback handler. The config object must have at least cloud_name and upload_preset properties with valid values. You can read more about Cloud Names and Upload Presets. Delivering Images with SDK The Cloudinary React SDK has three major components, Image, CloudinaryContext and Transformation: Image: This component is responsible for the actual delivery of images. It takes the image ID and asks the server for this image. When the image is provided, it is also responsible for painting the image on the browser. Transformation: This component is used to apply transformations to images delivered with Image. CloudinaryContext: You can specify Cloudinary configuration for each image on the Image component. This can be tedious when you are dealing with multiple images. CloudinaryContext allows you to apply configuration to a group of Images. Most times you would end up with a structure like this: <CloudinaryContext> <Image> <Transformation /> <Transformation /> </Image> <Image> <Transformation /> </Image> </CloudinaryContext> Back to our demo app, we can request an image from the Cloudinary server and display it with the following components: import React, { Component } from 'react'; import axios from 'axios'; import { CloudinaryContext, Transformation, Image } from 'cloudinary-react'; import { render } from 'react-dom'; class Main extends Component { constructor(props) { super(props); this.state = { gallery: [] } } componentDidMount() { // Request for images tagged xmas axios.get('http://res.cloudinary.com/christekh/image/list/xmas.json') .then(res => { console.log(res.data.resources); this.setState({gallery: res.data.resources}); }); } uploadWidget() { // . . . } render(){ return ( <div className="main"> <h1>Galleria</h1> <div className="gallery"> <CloudinaryContext cloudName="CLOUDNAME"> { this.state.gallery.map(data => { return ( <div className="responsive" key={data.public_id}> <div className="img"> <a target="_blank" href={`http://res.cloudinary.com/christekh/image/upload/${data.public_id}.jpg`}> <Image publicId={data.public_id}> <Transformation crop="scale" width="300" height="200" dpr="auto" responsive_placeholder="blank" /> </Image> </a> <div className="desc">Created at {data.created_at}</div> </div> </div> ) }) } </CloudinaryContext> <div className="clearfix"></div> </div> </div> ); } } render(<Main />, document.getElementById('container')); Take one more look at the upload code: cloudinary.openUploadWidget({ cloud_name: 'christekh', upload_preset: 'idcidr0h', tags:['xmas']}, function(error, result) { . . . Each image is tagged with xmas, which serves as a way to request images with this tag as a collection. This is exactly what we are using the axios library to do when the component mounts: axios.get('http://res.cloudinary.com/CLOUDNAME/image/list/xmas.json') .then(res => { console.log(res.data.resources); this.setState({gallery: res.data.resources}); }); axios uses promises, so whenever the promise resolves in our case, we have a payload of images. We take advantage of React state to update our UI with the fetched resources. Down to rendering, we configure the CloudinaryContext with our cloud_name, iterate over the gallery state that stores the images and displays them using the Image component. We also apply few transformations using the Transformation component. For security reasons, Cloudinary will not allow you to make such request from the client unless you tell it to. The best way to go is to use the admin API via a backend SDK and then send the resource list to the client. Updating State with New Uploads We are able to upload images and request for images to be displayed on the user’s browsers. Here is how we update the displayed images instantly when the user uploads a new image: uploadWidget() { let _this = this; cloudinary.openUploadWidget({ cloud_name: 'CLOUDNAME', upload_preset: 'PRESET', tags:['xmas']}, function(error, result) { // Update gallery state with newly uploaded image _this.setState({gallery: _this.state.gallery.concat(result)}) }); } Rather than logging the uploaded image information to the console, we update the gallery state, which bears the list of requested images, by concatenating the uploaded result to the gallery. Image Management Simplified Image uploads, transformation and delivery has never been easier. These tasks have been a serious challenge for developers. Cloudinary has created a way to abstract all this hard work, enabling you to simply plug and play. Full Article
react The Diverse React Navigation Ecosystem By reactjsnews.com Published On :: Mon, 06 Mar 2017 17:00:00 +0000 The routing ecosystem around React and React Native is quite different. One is characterized by a strong incumbent, and the other is plagued by rapid change. React JS No question about it, React Router (ReactTraining/react-router) is king here. They have the benefit of several years of active development, along with an active community submitting PR’s, fixes, etc. Supplement that with myriad tutorials and how-to’s and you end up with a well-supported, stable product. To be fair, React Router has suffered some major API upsets, and is nearly the poster-child for javascript fatigue but the maintainers have declared their lasting support for a few specific versions, which means you can plop down with V3 and be good to go for the next 12 to 24 months. React Native Ok, this is where things start to get really, really crazy. The most important thing to keep in mind is that the React Native team has produced three navigation helpers: NavigatorIOS, Navigator, and NavigatorExperimental. NavigatorIOS was quickly deprecated, as it was supported only by (you guessed it) IOS. Navigator is the currently endorsed solution for navigation, at least if you are following the official docs. However, its about to be upset by- NavigationExperimental. This is an updated navigator that has learned some lessons from Navigator, and has some solid integration with Redux. ‘Navigator’ is (or was!) sleighted to be deprecated in favor of NavigationExperimental at some point. Already you have three ‘official’ navigators supported by the React Native team. The big issue with all three of these is that they are somewhat lightweight and don’t include a lot of common navigation situations out of the box, like sidebars, tab bars, headers, etc. To solve that, the community has introduced… React Native Router Flux (aksonov/react-native-router-flux). My personal favorite, this is router is based upon NavigationExperimental. You can imagine that the authors looked at NavigationExperimental, realized that everyone would be writing the same wrapper code around it, and so created this project. React Native Router (t4t5/react-native-router). Haven’t used it, but it is colossally popular. React Router Native (jmurzy/react-router-native). Strives for API conformity with React Router (the above mentioned one). The great approach here is that they bring in the concept of a URL in native apps, where one doesn’t otherwise exist. This is a great approach that simplifies a lot of common routing situations. Of course, there’s one more big solution that is supposedly going to become the standard: React Navigation (react-community/react-navigation). Seen as a solution that will soon be ‘official’ in the community, it is intended to replaced NavigationExperimental. This package is still in active development, so I expect at least a bit of API upset over the coming months. If you want to use official solutions, go with this, if you want a tried and true solution, go with React Native Router Flux. Full Article
react Component Kits for React Native By reactjsnews.com Published On :: Tue, 07 Mar 2017 17:00:00 +0000 You won’t find as many styling solutions for React Native as you will for React JS. This stems from two simple realities: React Native is a much smaller target for component libraries than traditional CSS frameworks. In other words, Bootstrap CSS can be used with any web framework, whereas component libraries for React Native only work with…you guessed it…React Native. Customizing React Native styling isn’t the easiest thing in the world. Many apps demand custom styling, which makes component kits not too useful. In addition, it is challenging to customize each and every component, as the flexibility that you gain with traditional CSS on the web doesn’t carry over easily to component libraries. With that said, here are a few options. You won’t find as many styling solutions for React Native as you will for React JS. This stems from two simple realities: React Native is a much smaller target for component libraries than traditional CSS frameworks. In other words, Bootstrap CSS can be used with any web framework, whereas component libraries for React Native only work with…you guessed it…React Native. Customizing React Native styling isn’t the easiest thing in the world. Many apps demand custom styling, which makes component kits not too useful. In addition, it is challenging to customize each and every component, as the flexibility that you gain with traditional CSS on the web doesn’t carry over easily to component libraries. With that said, here are a few options. NativeBase - Essential cross-platform UI components for React Native A huge collection of components, most of which look quite nice. That’s the plus side. The down side is that some of the components are somewhat buggy. No offense to the library authors, its just the state of the library - it needs a bit of work. For example, here’s an issue I opened a few days ago when I discovered the swipe deck component crashed when only a single data element was provided: DeskSwiper throws on single element lists · Issue #562 · GeekyAnts/NativeBase. The authors fixed it up awfully fast, but, hey, that’s a bug that seems like it could have been caught earlier. React Native Elements - react-native-community/react-native-elements This is my personal favorite. The styling is generally platform agnostic; it won’t look out of place using it on either Android or iOS. Each component has simple customization, the docs are solid, and it comes with a good set of icons. This is a no-brainer. React Native Material Design - react-native-material-design/react-native-material-design Another solid choice, but mostly only useful for Android. Again, its a bit unsettling to see material design - traditionally a stable of Android devices - on iOS. Besides that, the docs are still a work in progress, as evidenced by the lack of docs for nearly half of the components. Nonetheless, if you’re looking for a material design solution, this is better than nothing. It is also worth noting that the project looks generally unmaintained. React Native Material Kit - xinthink/react-native-material-kit Another material design solution, but much better maintained than React Native Material Design. This one has the added benefit of a nicer customization API for creating your own custom components - see the docs on this. It also has some more dynamic components like progress bars and sliders, which you may not see on other frameworks. Anything that helps save you time to build your app is always a solid benefit. Do Your Own Styling! If none of these choices float your boat, you can always learn how to style components from scratch yourself. I have a course on Udemy that will teach you how to make perfectly reusable components for your own projects. Check it out here: The Complete React Native and Redux Course - Udemy Full Article
react brahim Kane of Mali reacts during the FIFA U-17 World Cup India 2017 3rd Place match By www.fifa.com Published On :: Sat, 28 Oct 2017 14:09:00 GMT KOLKATA, INDIA - OCTOBER 28: Ibrahim Kane of Mali reacts during the FIFA U-17 World Cup India 2017 3rd Place match between Brazil and Mali at Vivekananda Yuba Bharati Krirangan on October 28, 2017 in Kolkata, India. (Photo by Buda Mendes - FIFA/FIFA via Getty Images) Full Article Area=Tournament Section=Competition Kind=Photo Tournament=FIFA U-17 World Cup India 2017
react Philip Foden of England reacts By www.fifa.com Published On :: Sat, 28 Oct 2017 16:58:00 GMT KOLKATA, INDIA - OCTOBER 28: Philip Foden of England reacts during the FIFA U-17 World Cup India 2017 Final match between England and Spain at Vivekananda Yuba Bharati Krirangan on October 28, 2017 in Kolkata, India. (Photo by Tom Dulat - FIFA/FIFA via Getty Images) Full Article Area=Tournament Section=Competition Kind=Photo Tournament=FIFA U-17 World Cup India 2017
react Cristian Borruto of Argentina reacts after he scores By www.fifa.com Published On :: Thu, 29 Sep 2016 01:41:00 GMT CALI, COLOMBIA - SEPTEMBER 28: Cristian Borruto of Argentina reacts after he scores during the FIFA Futsal World Cup Semi Final match between Argentina and Portugal at the Coliseo el Pueblo Stadium on September 28, 2016 in Cali, Colombia. (Photo by Ian MacNicol - FIFA/FIFA via Getty Images) Full Article Area=Tournament Section=Competition Kind=Photo Tournament=FIFA Futsal World Cup Colombia 2016
react Portugal's Ricardinho (L) and Bebe react after getting scored by Argentina By www.fifa.com Published On :: Thu, 29 Sep 2016 02:01:00 GMT Portugal's Ricardinho (L) and Bebe react after getting scored by Argentina during their Colombia 2016 FIFA Futsal World Cup match at the Coliseo El Pueblo stadium, in Cali, Colombia on September 28, 2016. / AFP / LUIS ROBAYO Full Article Area=Tournament Section=Competition Kind=Photo Tournament=FIFA Futsal World Cup Colombia 2016
react Portugal's Ricardinho reacts after being defeated by Argentina By www.fifa.com Published On :: Thu, 29 Sep 2016 03:13:00 GMT Portugal's Ricardinho reacts after being defeated by Argentina during their Colombia 2016 FIFA Futsal World Cup match at the Coliseo El Pueblo stadium, in Cali, Colombia on September 28, 2016. / AFP / LUIS ROBAYO Full Article Area=Tournament Section=Competition Kind=Photo Tournament=FIFA Futsal World Cup Colombia 2016
react Nicolas Sarmiento of Argentina reacts as his teammate Leandro Cuzzolino scores By www.fifa.com Published On :: Thu, 29 Sep 2016 03:37:00 GMT CALI, COLOMBIA - SEPTEMBER 28: Nicolas Sarmiento of Argentina reacts as his teammate Leandro Cuzzolino scores his team's fifth goal during the FIFA Futsal World Cup Semi-Final match between Argentina and Portugal at the Coliseo El Pueblo stadium on September 28, 2016 in Cali, Colombia. (Photo by Alex Caparros - FIFA/FIFA via Getty Images) Full Article Area=Tournament Section=Competition Kind=Photo Tournament=FIFA Futsal World Cup Colombia 2016
react Cristian Borruto of Argentina reacts after he scores against Portugal By www.fifa.com Published On :: Fri, 30 Sep 2016 16:05:00 GMT CALI, COLOMBIA - SEPTEMBER 28: Cristian Borruto of Argentina reacts after he scores during the FIFA Futsal World Cup Semi Final match between Argentina and Portugal at the Coliseo el Pueblo Stadium on September 28, 2016 in Cali, Colombia. (Photo by Ian MacNicol - FIFA/FIFA via Getty Images) Full Article Area=Tournament Section=Competition Kind=Photo Tournament=FIFA Futsal World Cup Colombia 2016
react Seyed Nazemalsharieh the manager of Iran reacts to a missed opportunity By www.fifa.com Published On :: Sat, 01 Oct 2016 19:05:00 GMT Seyed Nazemalsharieh the manager of Iran reacts to a missed opportunity during the FIFA Futsal World Cup Third Place play off match between Iran and Portugal at the Coliseo el Pueblo Stadium on on October 1, 2016 in Cali, Colombia. (Photo by Ian MacNicol - FIFA/FIFA via Getty Images) Full Article Area=Tournament Section=Competition Kind=Photo Tournament=FIFA Futsal World Cup Colombia 2016
react Joachim Low reacts to the FIFA Confederations Cup Official Draw By www.fifa.com Published On :: Sat, 26 Nov 2016 18:09:00 GMT Joachim Low reacts to the FIFA Confederations Cup Official Draw Full Article Area=Tournament Section=Competition Kind=Video Tournament=FIFA Confederations Cup Russia 2017
react Fernando Santos reacts to the FIFA Confederations Cup Official Draw By www.fifa.com Published On :: Sat, 26 Nov 2016 18:09:00 GMT Fernando Santos reacts to the FIFA Confederations Cup Official Draw Full Article Area=Tournament Section=Competition Kind=Video Tournament=FIFA Confederations Cup Russia 2017
react Ange Postecoglou reacts to the FIFA Confederations Cup Official Draw By www.fifa.com Published On :: Sat, 26 Nov 2016 18:10:00 GMT Ange Postecoglou reacts to the FIFA Confederations Cup Official Draw Full Article Area=Tournament Section=Competition Kind=Video Tournament=FIFA Confederations Cup Russia 2017
react Juan Antonio Pizzi reacts to the FIFA Confederations Cup Official Draw By www.fifa.com Published On :: Sat, 26 Nov 2016 18:11:00 GMT Juan Antonio Pizzi reacts to the FIFA Confederations Cup Official Draw Full Article Area=Tournament Section=Competition Kind=Video Tournament=FIFA Confederations Cup Russia 2017
react Stanislav Cherchesov reacts to the FIFA Confederations Cup Official Draw By www.fifa.com Published On :: Sat, 26 Nov 2016 18:12:00 GMT Stanislav Cherchesov reacts to the FIFA Confederations Cup Official Draw Full Article Area=Tournament Section=Competition Kind=Video Tournament=FIFA Confederations Cup Russia 2017
react Anthony Hudson reacts to the FIFA Confederations Cup Official Draw By www.fifa.com Published On :: Sat, 26 Nov 2016 18:12:00 GMT Anthony Hudson reacts to the FIFA Confederations Cup Official Draw Full Article Area=Tournament Section=Competition Kind=Video Tournament=FIFA Confederations Cup Russia 2017
react Juan Carlos Osorio reacts to the FIFA Confederations Cup Official Draw By www.fifa.com Published On :: Sat, 26 Nov 2016 18:28:00 GMT Juan Carlos Osorio reacts to the FIFA Confederations Cup Official Draw Full Article Area=Tournament Section=Competition Kind=Video Tournament=FIFA Confederations Cup Russia 2017
react Sergio Ramos of Real Madrid reacts during the La Liga By www.fifa.com Published On :: Sun, 16 Dec 2018 08:38:00 GMT EIBAR, SPAIN - NOVEMBER 24: Sergio Ramos of Real Madrid reacts during the La Liga match between SD Eibar and Real Madrid CF at Ipurua Municipal Stadium on November 24, 2018 in Eibar, Spain. (Photo by Juan Manuel Serrano Arce/Getty Images) Full Article Area=Tournament Section=Competition Kind=Photo Tournament=FIFA Club World Cup UAE 2018
react Chamseddine Dhaouadi of ES Tunis reacts By www.fifa.com Published On :: Tue, 18 Dec 2018 14:18:00 GMT AL AIN, UNITED ARAB EMIRATES - DECEMBER 18: Chamseddine Dhaouadi of ES Tunis reacts during the FIFA Club World Cup UAE 2018 5th Place Match between ES Tunis and CD Guadalajara at Hazza Bin Zayed Stadium on December 18, 2018 in Al Ain, United Arab Emirates. (Photo by Francois Nel/Getty Images) Full Article Area=Tournament Section=Competition Kind=Photo Tournament=FIFA Club World Cup UAE 2018
react Angel Zaldivar of CD Guadalajara reacts after a missed chance By www.fifa.com Published On :: Tue, 18 Dec 2018 15:13:00 GMT AL AIN, UNITED ARAB EMIRATES - DECEMBER 18: Angel Zaldivar of CD Guadalajara reacts after a missed chance during the FIFA Club World Cup UAE 2018 5th Place Match between ES Tunis and CD Guadalajara at Hazza Bin Zayed Stadium on December 18, 2018 in Al Ain, United Arab Emirates. (Photo by Francois Nel/Getty Images) Full Article Area=Tournament Section=Competition Kind=Photo Tournament=FIFA Club World Cup UAE 2018
react Marcus Berg of Al Ain reacts By www.fifa.com Published On :: Tue, 18 Dec 2018 17:12:00 GMT AL AIN, UNITED ARAB EMIRATES - DECEMBER 18: Marcus Berg of Al Ain reacts during the FIFA Club World Cup UAE 2018 Semi Final Match between River Plate and Al Ain at Hazza Bin Zayed Stadium on December 18, 2018 in Al Ain, United Arab Emirates. (Photo by Francois Nel/Getty Images) Full Article Area=Tournament Section=Competition Kind=Photo Tournament=FIFA Club World Cup UAE 2018