ea Coronavirus: Thanking healthcare workers worldwide By www.bbc.co.uk Published On :: Mon, 04 May 2020 23:00:11 GMT Some of the ways that people have expressed thanks to workers on the frontline against Covid-19. Full Article
ea Coronavirus by Air: The spread of Covid-19 in the Middle East By www.bbc.co.uk Published On :: Tue, 05 May 2020 12:47:26 GMT An investigation by BBC News Arabic has found how one Iranian airline contributed to the spread of coronavirus around the Middle East. Full Article
ea Five-year-old caught driving parents' car in Utah By www.bbc.co.uk Published On :: Tue, 05 May 2020 17:27:32 GMT The boy said he was travelling to California to buy a Lamborghini. Full Article
ea How the Covid-19 pandemic is threatening Africa’s wildlife By www.bbc.co.uk Published On :: Wed, 06 May 2020 23:24:20 GMT Park rangers in Africa say the closure of safari tourism is leading to an increase in poaching. Full Article
ea ICYMI: Penguin chicks and new dining ideas By www.bbc.co.uk Published On :: Sat, 09 May 2020 10:43:24 GMT Some of the stories from around the world that you may have missed this week. Full Article
ea Norfolk Island morepork owls: Major breakthrough for rare species By www.bbc.co.uk Published On :: Fri, 08 May 2020 16:06:21 GMT Two fledglings may have safeguarded the future of the Norfolk Island morepork owl. Full Article
ea Ahmaud Arbery: Joggers out in solidarity with the killed 25-year-old By www.bbc.co.uk Published On :: Fri, 08 May 2020 22:58:30 GMT People have been dedicating their workouts to Ahmaud Arbery who was shot and killed while out jogging. Full Article
ea My glamorous life: are you ready to math? By www.zeldman.com Published On :: Sun, 12 May 2019 22:15:07 +0000 For the past two years, I’ve been publishing a daily work-and-life diary on Basecamp, sharing it with a few friends. This private writing work supplanted the daily public writing I used to do here. In an experiment, I’m publishing yesterday’s diary entry here today: YESTERDAY, Ava and a few of her schoolmates participated in a […] The post My glamorous life: are you ready to math? appeared first on Zeldman on Web & Interaction Design. Full Article family glamorous parenting
ea The Beauty Trap in Design [Automattic.Design] By www.zeldman.com Published On :: Fri, 25 Oct 2019 14:39:43 +0000 I love a good page layout. I’m a chump for a visually well composed series of paragraphs. The proper degree of corner rounding for a given set of photos in relation to a box three columns over sets my little heart aflutter. The post The Beauty Trap in Design [Automattic.Design] appeared first on Zeldman on Web & Interaction Design. Full Article Design
ea Another Blue Beanie Day By www.zeldman.com Published On :: Sun, 01 Dec 2019 18:05:15 +0000 Yesterday was the nth annual Blue Beanie Day. (I’ve lost track of what year the standardista holiday started.) I was awake at 1:00 AM on Friday night/Saturday morning, so I tweeted “Happy #BlueBeanieDay,” then slept. No blog post, no prelude—just a past-midnight tweet, over and out. Saturday, once or twice, I checked Twitter and retweeted […] The post Another Blue Beanie Day appeared first on Zeldman on Web & Interaction Design. Full Article Blue Beanie Day glamorous industry State of the Web a11y blue beanie day frontend inclusive design progressive enhancement web standards
ea 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
ea 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
ea 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
ea Building Great User Experiences with Concurrent Mode and Suspense By reactjs.org Published On :: Wed, 06 Nov 2019 00:00:00 GMT At React Conf 2019 we announced an experimental release of React that supports Concurrent Mode and Suspense. In this post we’ll introduce best practices for using them that we’ve identified through the process of building the new facebook.com. This post will be most relevant to people working on data fetching libraries for React. It shows how to best integrate them with Concurrent Mode and Suspense. The patterns introduced here are based on Relay — our library for building data-driven UIs with GraphQL. However, the ideas in this post apply to other GraphQL clients as well as libraries using REST or other approaches. This post is aimed at library authors. If you’re primarily an application developer, you might still find some interesting ideas here, but don’t feel like you have to read it in its entirety. Talk Videos If you prefer to watch videos, some of the ideas from this blog post have been referenced in several React Conf 2019 presentations: Data Fetching with Suspense in Relay by Joe Savona Building the New Facebook with React and Relay by Ashley Watkins React Conf Keynote by Yuzhi Zheng This post presents a deeper dive on implementing a data fetching library with Suspense. Putting User Experience First The React team and community has long placed a deserved emphasis on developer experience: ensuring that React has good error messages, focusing on components as a way to reason locally about app behavior, crafting APIs that are predictable and encourage correct usage by design, etc. But we haven’t provided enough guidance on the best ways to achieve a great user experience in large apps. For example, the React team has focused on framework performance and providing tools for developers to debug and tune application performance (e.g. React.memo). But we haven’t been as opinionated about the high-level patterns that make the difference between fast, fluid apps and slow, janky ones. We always want to ensure that React remains approachable to new users and supports a variety of use-cases — not every app has to be “blazing” fast. But as a community we can and should aim high. We should make it as easy as possible to build apps that start fast and stay fast, even as they grow in complexity, for users on varying devices and networks around the world. Concurrent Mode and Suspense are experimental features that can help developers achieve this goal. We first introduced them at JSConf Iceland in 2018, intentionally sharing details very early to give the community time to digest the new concepts and to set the stage for subsequent changes. Since then we’ve completed related work, such as the new Context API and the introduction of Hooks, which are designed in part to help developers naturally write code that is more compatible with Concurrent Mode. But we didn’t want to implement these features and release them without validating that they work. So over the past year, the React, Relay, web infrastructure, and product teams at Facebook have all collaborated closely to build a new version of facebook.com that deeply integrates Concurrent Mode and Suspense to create an experience with a more fluid and app-like feel. Thanks to this project, we’re more confident than ever that Concurrent Mode and Suspense can make it easier to deliver great, fast user experiences. But doing so requires rethinking how we approach loading code and data for our apps. Effectively all of the data-fetching on the new facebook.com is powered by Relay Hooks — new Hooks-based Relay APIs that integrate with Concurrent Mode and Suspense out of the box. Relay Hooks — and GraphQL — won’t be for everyone, and that’s ok! Through our work on these APIs we’ve identified a set of more general patterns for using Suspense. Even if Relay isn’t the right fit for you, we think the key patterns we’ve introduced with Relay Hooks can be adapted to other frameworks. Best Practices for Suspense It’s tempting to focus only on the total startup time for an app — but it turns out that users’ perception of performance is determined by more than the absolute loading time. For example, when comparing two apps with the same absolute startup time, our research shows that users will generally perceive the one with fewer intermediate loading states and fewer layout changes as having loaded faster. Suspense is a powerful tool for carefully orchestrating an elegant loading sequence with a few, well-defined states that progressively reveal content. But improving perceived performance only goes so far — our apps still shouldn’t take forever to fetch all of their code, data, images, and other assets. The traditional approach to loading data in React apps involves what we refer to as “fetch-on-render”. First we render a component with a spinner, then fetch data on mount (componentDidMount or useEffect), and finally update to render the resulting data. It’s certainly possible to use this pattern with Suspense: instead of initially rendering a placeholder itself, a component can “suspend” — indicate to React that it isn’t ready yet. This will tell React to find the nearest ancestor <Suspense fallback={<Placeholder/>}>, and render its fallback instead. If you watched earlier Suspense demos this example may feel familiar — it’s how we originally imagined using Suspense for data-fetching. It turns out that this approach has some limitations. Consider a page that shows a social media post by a user, along with comments on that post. That might be structured as a <Post> component that renders both the post body and a <CommentList> to show the comments. Using the fetch-on-render approach described above to implement this could cause sequential round trips (sometimes referred to as a “waterfall”). First the data for the <Post> component would be fetched and then the data for <CommentList> would be fetched, increasing the time it takes to show the full page. There’s also another often-overlooked downside to this approach. If <Post> eagerly requires (or imports) the <CommentList> component, our app will have to wait to show the post body while the code for the comments is downloading. We could lazily load <CommentList>, but then that would delay fetching comments data and increase the time to show the full page. How do we resolve this problem without compromising on the user experience? Render As You Fetch The fetch-on-render approach is widely used by React apps today and can certainly be used to create great apps. But can we do even better? Let’s step back and consider our goal. In the above <Post> example, we’d ideally show the more important content — the post body — as early as possible, without negatively impacting the time to show the full page (including comments). Let’s consider the key constraints on any solution and look at how we can achieve them: Showing the more important content (the post body) as early as possible means that we need to load the code and data for the view incrementally. We don’t want to block showing the post body on the code for <CommentList> being downloaded, for example. At the same time we don’t want to increase the time to show the full page including comments. So we need to start loading the code and data for the comments as soon as possible, ideally in parallel with loading the post body. This might sound difficult to achieve — but these constraints are actually incredibly helpful. They rule out a large number of approaches and spell out a solution for us. This brings us to the key patterns we’ve implemented in Relay Hooks, and that can be adapted to other data-fetching libraries. We’ll look at each one in turn and then see how they add up to achieve our goal of fast, delightful loading experiences: Parallel data and view trees Fetch in event handlers Load data incrementally Treat code like data Parallel Data and View Trees One of the most appealing things about the fetch-on-render pattern is that it colocates what data a component needs with how to render that data. This colocation is great — an example of how it makes sense to group code by concerns and not by technologies. All the issues we saw above were due to when we fetch data in this approach: upon rendering. We need to be able to fetch data before we’ve rendered the component. The only way to achieve that is by extracting the data dependencies into parallel data and view trees. Here’s how that works in Relay Hooks. Continuing our example of a social media post with body and comments, here’s how we might define it with Relay Hooks: // Post.js function Post(props) { // Given a reference to some post - `props.post` - *what* data // do we need about that post? const postData = useFragment(graphql` fragment PostData on Post @refetchable(queryName: "PostQuery") { author title # ... more fields ... } `, props.post); // Now that we have the data, how do we render it? return ( <div> <h1>{postData.title}</h1> <h2>by {postData.author}</h2> {/* more fields */} </div> ); } Although the GraphQL is written within the component, Relay has a build step (Relay Compiler) that extracts these data-dependencies into separate files and aggregates the GraphQL for each view into a single query. So we get the benefit of colocating concerns, while at runtime having parallel data and view trees. Other frameworks could achieve a similar effect by allowing developers to define data-fetching logic in a sibling file (maybe Post.data.js), or perhaps integrate with a bundler to allow defining data dependencies with UI code and automatically extracting it, similar to Relay Compiler. The key is that regardless of the technology we’re using to load our data — GraphQL, REST, etc — we can separate what data to load from how and when to actually load it. But once we do that, how and when do we fetch our data? Fetch in Event Handlers Imagine that we’re about to navigate from a list of a user’s posts to the page for a specific post. We’ll need to download the code for that page — Post.js — and also fetch its data. Waiting until we render the component has problems as we saw above. The key is to start fetching code and data for a new view in the same event handler that triggers showing that view. We can either fetch the data within our router — if our router supports preloading data for routes — or in the click event on the link that triggered the navigation. It turns out that the React Router folks are already hard at work on building APIs to support preloading data for routes. But other routing frameworks can implement this idea too. Conceptually, we want every route definition to include two things: what component to render and what data to preload, as a function of the route/url params. Here’s what such a route definition might look like. This example is loosely inspired by React Router’s route definitions and is primarily intended to demonstrate the concept, not a specific API: // PostRoute.js (GraphQL version) // Relay generated query for loading Post data import PostQuery from './__generated__/PostQuery.graphql'; const PostRoute = { // a matching expression for which paths to handle path: '/post/:id', // what component to render for this route component: React.lazy(() => import('./Post')), // data to load for this route, as function of the route // parameters prepare: routeParams => { // Relay extracts queries from components, allowing us to reference // the data dependencies -- data tree -- from outside. const postData = preloadQuery(PostQuery, { postId: routeParams.id, }); return { postData }; }, }; export default PostRoute; Given such a definition, a router can: Match a URL to a route definition. Call the prepare() function to start loading that route’s data. Note that prepare() is synchronous — we don’t wait for the data to be ready, since we want to start rendering more important parts of the view (like the post body) as quickly as possible. Pass the preloaded data to the component. If the component is ready — the React.lazy dynamic import has completed — the component will render and try to access its data. If not, React.lazy will suspend until the code is ready. This approach can be generalized to other data-fetching solutions. An app that uses REST might define a route like this: // PostRoute.js (REST version) // Manually written logic for loading the data for the component import PostData from './Post.data'; const PostRoute = { // a matching expression for which paths to handle path: '/post/:id', // what component to render for this route component: React.lazy(() => import('./Post')), // data to load for this route, as function of the route // parameters prepare: routeParams => { const postData = preloadRestEndpoint( PostData.endpointUrl, { postId: routeParams.id, }, ); return { postData }; }, }; export default PostRoute; This same approach can be employed not just for routing, but in other places where we show content lazily or based on user interaction. For example, a tab component could eagerly load the first tab’s code and data, and then use the same pattern as above to load the code and data for other tabs in the tab-change event handler. A component that displays a modal could preload the code and data for the modal in the click handler that triggers opening the modal, and so on. Once we’ve implemented the ability to start loading code and data for a view independently, we have the option to go one step further. Consider a <Link to={path} /> component that links to a route. If the user hovers over that link, there’s a reasonable chance they’ll click it. And if they press the mouse down, there’s an even better chance that they’ll complete the click. If we can load code and data for a view after the user clicks, we can also start that work before they click, getting a head start on preparing the view. Best of all, we can centralize that logic in a few key places — a router or core UI components — and get any performance benefits automatically throughout our app. Of course preloading isn’t always beneficial. It’s something an application would tune based on the user’s device or network speed to avoid eating up user’s data plans. But the pattern here makes it easier to centralize the implementation of preloading and the decision of whether to enable it or not. Load Data Incrementally The above patterns — parallel data/view trees and fetching in event handlers — let us start loading all the data for a view earlier. But we still want to be able to show more important parts of the view without waiting for all of our data. At Facebook we’ve implemented support for this in GraphQL and Relay in the form of some new GraphQL directives (annotations that affect how/when data is delivered, but not what data). These new directives, called @defer and @stream, allow us to retrieve data incrementally. For example, consider our <Post> component from above. We want to show the body without waiting for the comments to be ready. We can achieve this with @defer and <Suspense>: // Post.js function Post(props) { const postData = useFragment(graphql` fragment PostData on Post { author title # fetch data for the comments, but don't block on it being ready ...CommentList @defer } `, props.post); return ( <div> <h1>{postData.title}</h1> <h2>by {postData.author}</h2> {/* @defer pairs naturally with <Suspense> to make the UI non-blocking too */} <Suspense fallback={<Spinner/>}> <CommentList post={postData} /> </Suspense> </div> ); } Here, our GraphQL server will stream back the results, first returning the author and title fields and then returning the comment data when it’s ready. We wrap <CommentList> in a <Suspense> boundary so that we can render the post body before <CommentList> and its data are ready. This same pattern can be applied to other frameworks as well. For example, apps that call a REST API might make parallel requests to fetch the body and comments data for a post to avoid blocking on all the data being ready. Treat Code Like Data But there’s one thing that’s still missing. We’ve shown how to preload data for a route — but what about code? The example above cheated a bit and used React.lazy. However, React.lazy is, as the name implies, lazy. It won’t start downloading code until the lazy component is actually rendered — it’s “fetch-on-render” for code! To solve this, the React team is considering APIs that would allow bundle splitting and eager preloading for code as well. That would allow a user to pass some form of lazy component to a router, and for the router to trigger loading the code alongside its data as early as possible. Putting It All Together To recap, achieving a great loading experience means that we need to start loading code and data as early as possible, but without waiting for all of it to be ready. Parallel data and view trees allow us to load the data for a view in parallel with loading the view (code) itself. Fetching in an event handler means we can start loading data as early as possible, and even optimistically preload a view when we have enough confidence that a user will navigate to it. Loading data incrementally allows us to load important data earlier without delaying the fetching of less important data. And treating code as data — and preloading it with similar APIs — allows us to load it earlier too. Using These Patterns These patterns aren’t just ideas — we’ve implemented them in Relay Hooks and are using them in production throughout the new facebook.com (which is currently in beta testing). If you’re interested in using or learning more about these patterns, here are some resources: The React Concurrent docs explore how to use Concurrent Mode and Suspense and go into more detail about many of these patterns. It’s a great resource to learn more about the APIs and use-cases they support. The experimental release of Relay Hooks implements the patterns described here. We’ve implemented two similar example apps that demonstrate these concepts: The Relay Hooks example app uses GitHub’s public GraphQL API to implement a simple issue tracker app. It includes nested route support with code and data preloading. The code is fully commented — we encourage cloning the repo, running the app locally, and exploring how it works. We also have a non-GraphQL version of the app that demonstrates how these concepts can be applied to other data-fetching libraries. While the APIs around Concurrent Mode and Suspense are still experimental, we’re confident that the ideas in this post are proven by practice. However, we understand that Relay and GraphQL aren’t the right fit for everyone. That’s ok! We’re actively exploring how to generalize these patterns to approaches such as REST, and are exploring ideas for a more generic (ie non-GraphQL) API for composing a tree of data dependencies. In the meantime, we’re excited to see what new libraries will emerge that implement the patterns described in this post to make it easier to build great, fast user experiences. Full Article
ea 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
ea Node 14 has been released By nodeweekly.com Published On :: Thu, 23 Apr 2020 00:00:00 +0000 #335 — April 23, 2020 Read on the Web Node Weekly Node.js 14 Released — Woo-hoo another major release of Node.js is here. v14 now becomes the current ‘release’ line with it becoming a LTS (Long Term Support) release in October.. so production apps would, ideally, remain on v12 for now. So what’s new..? Diagnostic reports are now a stable feature. It's based on V8 8.1. An experimental Async Local Storage API Improvements to streams. An experimental WebAssembly System Interface (WASI) to support future WebAssembly use cases. Bye bye to the ESM module ‘experimental’ warning (though it still is experimental). Michael Dawson and Bethany Griggs Learn Hardcore Functional Programming in JavaScript — Join Brian Lonsdorf and learn how to apply such concepts as pure functions, currying, composition, functors, monads and more. Frontend Masters sponsor Puppeteer 3.0: Say Hello to Firefox — Best known as a way to headlessly control Chrome from Node, Puppeteer has recently seen some competition in the form of the cross-browser Playwright recently. But competition can be good and Puppeteer now supports Firefox too. Mathias Bynens ZEIT Is Now Vercel — You probably best know ZEIT as the creators and maintainers of the popular Next.js React framework and their ‘Now’ deployment and hosting platform. Vercel New OpenSSL Security Release To Require Node Updates? Maybe Not.. — A key security update to OpenSSL raised the possibility of widespread Node releases to incorporate the fixes, but initial suggestions are that Node isn’t affected. Fingers crossed! Sam Roberts ???? Jobs Node.js Developer at X-Team (Remote) — Join the most energizing community for developers. Work from anywhere with the world's leading brands. X-Team Find a Job Through Vettery — Vettery specializes in tech roles and is completely free for job seekers. Create a profile to get started. Vettery ℹ️ If you're interested in running a job listing in this newsletter, there's more info here. ???? Articles & Tutorials OneTesselAway: Building a Real-Time Public Transit Status Device — A developer wanted to know when the next bus would arrive.. while using lots of cool tech, including Node, the OneBusAway API, and the Tessel 2 IoT platform. Robert McGuire What is the toJSON() Function? — If an object has a toJSON function, JSON.stringify() calls toJSON() and serializes the return value from toJSON() instead. Valeri Karpov Top GitHub Best Practices for Developers - Expanded Guide — Implementing these best practices could save you time, improve code maintainability, and prevent security risks. Datree.io sponsor Refactor Your Node and Express APIs to Serverless with Azure Functions — John Papa points out a Microsoft tutorial that walks through the process of taking a Node API serverless with Azure’s Functions service. John Papa Querying SQL Server from Node with async/await Rob Tomlin Why I Stopped Using Microservices Robin Wieruch ???? Tools, Resources and Libraries lazynpm: A Terminal UI for npm — One of those sort of things you don’t realize you need until you give it a go. There’s a four-minute screencast if you want to see how it works without downloading. Jesse Duffield node-sqlite3 4.2: Async, Non-blocking SQLite3 Bindings for Node — 4.2.0 just came out. Mapbox ts-gphoto2-driver: A Node Wrapper for libgphoto2 — libgphoto2 provides a way to control a variety of digital cameras/DSLRs. Lenzotti Romain AppSignal Now Supports Node.js: Roadmap for the Coming Weeks AppSignal sponsor Rosetta: A General Purpose Internationalization Library in 292 Bytes — Less than 300 bytes, but does have a few dependencies. Aims to be very simple and is targeted at basic string use cases. Luke Edwards nodejs-dns 2.0: The Google Cloud DNS Client for Node Google node-osc 5.0: Open Sound Control Protocol Library — OSC is a protocol used to communicate between media devices. Myles Borins ts-node: TypeScript Execution and REPL for Node TypeStrong ???? And One for Fun.. npm trends: Compare NPM Package Downloads — A site to compare package download counts over time. For example, what about koa vs restify vs fastify? John Potter Full Article
ea Caddy 2.0 released, plus a little black hat Go By golangweekly.com Published On :: Fri, 8 May 2020 00:00:00 +0000 #311 — May 8, 2020 Unsubscribe : Read on the Web Golang Weekly Caddy 2: The Go-Powered Web Server with Automatic TLS — After over a year of redesign, Caddy 2 has a new architecture to v1. If you want a new HTTPS server that ‘just works’, Caddy is well worth a look IMO. Its lead creator, Matt Holt, answered lots of questions on this Hacker News thread about the release. Caddy Web Server Rek: An Easy HTTP Client for Go — The inspiration here is from Python’s very well known and highly esteemed Requests library.. so the Pythonistas among you might like this! Luc Perkins Modern Redis Features with RedisGreen — Online upgrades to the latest Redis 6.0 features, memory mapping, key size tracking, and more. RedisGreen sponsor Life Without Line Numbers — There’s a lot of buzz around reducing the size of Go binaries (1.15 does so by ~6%) and here’s another tactic: reduce the precision of the position information. The gain is 2-6%, depending on how far you take it. Josh Bleecher Snyder ▶ Discussing Black Hat Go — “Are you excited to learn about hacking and that?” Got an hour? Roberto Clapis, a security engineer at Google, and Tom Steele, a co-author of Black Hat Go, join the Go Time team to discuss security, penetration testing, and more. Go Time Podcast ???? Jobs Enjoy Building Scalable Infrastructure in Go? Stream Is Hiring — Like coding in Go? We do too. Stream is hiring in Amsterdam. Apply now. Stream Find a Job Through Vettery — Vettery specializes in tech roles and is completely free for job seekers. Create a profile to get started. Vettery ???? Articles & Tutorials Mid-Stack Inlining in Go — Inlining a function can lead to serious performance gains, so why not do it for everything? Well, there are always trade-offs. Dave Cheney Asynchronous Preemption in Go 1.14 — How the new preemption implementation works, including the use of a lesser-known signal (SIGURG). Vincent Blanchon Why Are My Go Executable Files Larger Than My Source Code? — We built a data visualization tool to find out. Here’s how we built it, and what we learned. Cockroach Labs sponsor Accelerating Aggregate MD5 Hashing Up to 800% with AVX512 — The culmination of this work is md5-simd, a Go library that performs such rapid MD5 hashing (when running concurrently). The use cases here are quite restricted but you may appreciate seeing how such things are implemented for any high end SIMD wrangling you need to do one day. MinIO Blog ▶ A Beginner's Guide to gRPC in Go — There’s a written version of the tutorial if you dislike videos. TutorialEdge Four Steps to Daemonize Your Go Programs — Daemons are programs that run as non-interactive background processes (e.g. background job processors, Web servers, database systems). Ilija Eftimov Go as a Scripting Language? — There’s plenty of folks that use Go as a scripting language, but there are challenges around REPLs and shebang support. Some of these challenges are being addressed today. Segio De Simone ???? Code & Tools UUID 3.3: A Pure Go Implementation of UUIDs — A pure Go implementation of Universally Unique Identifiers (UUID) as defined in RFC-4122 covering versions 1 through 5. The Go Commune Reed-Solomon: A Reed-Solomon Erasure Coding Library — A Go port of a Java library built by Backblaze that does Reed Solomon erasure coding (a way to send or store data in a larger form that’s resilient to data loss). Boasts operation of over 1GB/sec per core. Klaus Post ko 0.5: Build and Deploy Go Apps on Kubernetes — ko’s objective is to “to make containers invisible infrastructure.” It’s been rapidly maturing in the past few months too. Google Monitor the Health and Performance of Your Golang Apps with Datadog APM. Free Trial Datadog APM sponsor Tengo 2.2: A Fast Embeddable Script Language for Go — Quite a mature project now and worth a look if you need to add some dynamic scripting to your code. Daniel Kang UniPDF 3.7: A Library for Creating and Processing PDF Files — Pure Go, which is neat, but note it’s dual licensed: AGPL for open source, commercial for closed source projects. UniDoc Mockery: A Mock Code Generator for Go Interfaces Vektra Dynamo: An Expressive DynamoDB Library Greg Greg ???? Two Fun Side Projects gasm: An Experimental WASM Virtual Machine for Gophers — “I did this just for fun and for learning WASM specification.” Nonetheless, it works with basic examples. Takeshi Yoneda thdwb: A Homebrew Web Browser and Rendering Engine — Another experimental, fun learning project. You won’t be using it for your day to day browsing any time soon but projects like this keep the imagination fueled up. Danilo Fragoso It'd be quite cool to link to more fun Go experiments and side projects actually, so let us know if you work on any. Bonus points for games, musical, or Web experiences ???? Full Article
ea 'My search for the boy in a child abuse video' By www.bbc.co.uk Published On :: Sun, 08 Mar 2020 00:09:54 GMT Lucy Proctor was horrified when she was WhatsApped a sex abuse video. And she wanted to find out if the boy was safe. Full Article
ea ‘My toy walrus waited 25 years in the Arctic’ By www.bbc.co.uk Published On :: Mon, 02 Mar 2020 00:50:15 GMT Julia spent 25 years dreaming of her first home. Eventually she returned - and found a long-lost toy. Full Article
ea The actor who was really stabbed on stage By www.bbc.co.uk Published On :: Sat, 14 Mar 2020 00:57:41 GMT Conor Madden was playing Hamlet when a sword fight went badly wrong. Would he ever act again? Full Article
ea Coronavirus: The grandad who became a TikTok star without realising it By www.bbc.co.uk Published On :: Sun, 12 Apr 2020 23:42:47 GMT Joe Allington was persuaded to dance on TikTok for the first time in January. Now he's got 1.5 million followers. Full Article
ea Stop and search: the controversial police power By www.bbc.co.uk Published On :: Sat, 07 Dec 2019 09:04:42 GMT Reporter Aaron Roach Bridgeman speaks to suspects, police and campaigners. Full Article
ea Coronavirus: what we can learn from the war generation By www.bbc.co.uk Published On :: Thu, 09 Apr 2020 16:52:35 GMT What can younger people learn from the generations that lived through World War Two? Full Article
ea Coronavirus: DIY hair shaving and beauty treatments By www.bbc.co.uk Published On :: Fri, 17 Apr 2020 07:15:21 GMT As hair dye and clippers become the next thing on the stockpile list - we look at how people are managing their hair and beauty. Full Article
ea From patient to healer: How this woman is saving lives By www.bbc.co.uk Published On :: Wed, 08 Apr 2020 23:17:58 GMT Women who have overcome depression are running therapy sessions to help others Full Article
ea Dirty streaming: The internet's big secret By www.bbc.co.uk Published On :: Thu, 05 Mar 2020 01:03:57 GMT Figures suggest that IT now generates as much CO2 as flying, with some arguing it's nearly double. Full Article
ea Ramadan and Coronavirus: Breaking my fast on Zoom By www.bbc.co.uk Published On :: Thu, 30 Apr 2020 23:57:07 GMT How fasting in lockdown and isolation has changed Ramadan for young Muslims this year. Full Article
ea Virus vaccine research 'enormously accelerated' By www.bbc.co.uk Published On :: Tue, 14 Apr 2020 21:19:00 GMT A vaccine normally takes a decade to develop, but GSK and Sanofi want a viable coronavirus vaccine by the end of next year, GSK chief executive Emma Walmsley says. Full Article
ea Coronavirus: Should maternity and paternity leave be extended? By www.bbc.co.uk Published On :: Sun, 26 Apr 2020 23:22:29 GMT A petition calling for maternity leave to be extended due to coronavirus has attracted many signatures. Full Article
ea Coronavirus: Bread and cake tips from a self-isolating baker By www.bbc.co.uk Published On :: Fri, 08 May 2020 23:02:33 GMT Ray normally runs his family bakery, Rinkoffs, but is currently staying at home with his wife. Full Article
ea Coronavirus: Disease meets deforestation at heart of Brazil's Amazon By www.bbc.co.uk Published On :: Mon, 04 May 2020 01:24:37 GMT Coronavirus has overwhelmed Manaus, the Amazon's biggest city, and the worst is yet to come. Full Article
ea Coronavirus: Brazil's outbreak 'threatens Paraguay's success' By www.bbc.co.uk Published On :: Sat, 09 May 2020 04:20:41 GMT Paraguay's president says he has reinforced the border with the worst-hit country in South America. Full Article
ea 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
ea 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
ea 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
ea 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
ea 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
ea 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
ea 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
ea 2012 Club World Cup Final: Corinthians 1-0 Chelsea By www.fifa.com Published On :: Mon, 17 Dec 2012 02:43:00 GMT Corinthians and Chelsea met in the FIFA Club World Cup Cup Japan 2012 final. Watch highlights from the match when the South American champions defeated their European counterparts. Full Article Area=Tournament Section=Competition Kind=Video Tournament=FIFA Club World Cup Japan 2012
ea Al Ain 3-3 (4-3 pens) Team Wellington (UAE 2018) By www.fifa.com Published On :: Wed, 12 Dec 2018 20:01:00 GMT A penalty shootout decided the opening match of the FIFA Club World Cup UAE 2018. Hosts Al Ain knocked out OFC champions Team Wellington thanks to the heroics of Al Ain goalkeeper Khalid Eisa. Full Article Area=Tournament Section=Competition Kind=Match HL Tournament=FIFA Club World Cup UAE 2018
ea Real Madrid 4-1 Al Ain (UAE 2018) By www.fifa.com Published On :: Sat, 22 Dec 2018 19:43:00 GMT Real Madrid capped off another memorable year by claiming a third successive FIFA Club World Cup title, defeating host team Al Ain 4-1 at Abu Dhabi's Zayed Sports City Stadium. Full Article Area=Tournament Section=Competition Kind=Video Tournament=FIFA Club World Cup UAE 2018
ea Real Madrid CF 4-1Al Ain (UAE 2018) By www.fifa.com Published On :: Sat, 21 Dec 2019 11:21:00 GMT Real Madrid CF beat Al Ain in a 4-1 thriller in the FIFA Club World Cup (2018) final. Watch all 5 goals from the final, including Modric's outside the box curler. Full Article Area=Tournament Section=Competition Kind=Video Tournament=FIFA Club World Cup UAE 2018
ea Javier Ceppi, Praful Patel, and Jaime Yarza speak to the media during a press conference By www.fifa.com Published On :: Thu, 26 Oct 2017 14:03:00 GMT KOLKATA, INDIA - OCTOBER 26: L-R: Javier Ceppi, Tournament Director at LOC FIFA U-17 World Cup India 2017, Patel Praful and Head of FIFA Tournaments, Jaime Yarza speak to the media during a press conference ahead of the FIFA U-17 World Cup India 2017 tournament at Vivekananda Yuba Bharati Krirangan on October 26, 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
ea Javier Ceppi, Praful Patel and Jaime Yarza speak during a India 2017 press conference By www.fifa.com Published On :: Thu, 26 Oct 2017 14:07:00 GMT KOLKATA, INDIA - OCTOBER 26: L-R: Javier Ceppi, Tournament Director at LOC FIFA U-17 World Cup India 2017, Patel Praful and Head of FIFA Tournaments, Jaime Yarza speak to the media during a press conference ahead of the FIFA U-17 World Cup India 2017 tournament at Vivekananda Yuba Bharati Krirangan on October 26, 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
ea Praful Patel and Jaime Yarza speak to the media during an India 2017 press conference By www.fifa.com Published On :: Thu, 26 Oct 2017 14:11:00 GMT KOLKATA, INDIA - OCTOBER 26: Patel Praful and Head of FIFA Tournaments, Jaime Yarza speak to the media during a press conference ahead of the FIFA U-17 World Cup India 2017 tournament at Vivekananda Yuba Bharati Krirangan on October 26, 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
ea The trophy is pictured ahead of the FIFA U-17 World Cup India 2017 Final By www.fifa.com Published On :: Fri, 27 Oct 2017 16:25:00 GMT KOLKATA, INDIA - OCTOBER 27: The trophy is pictured ahead of the FIFA U-17 World Cup India 2017 Final match between England and Spain at Vivekananda Yuba Bharati Krirangan on October 27, 2017 in Kolkata, India. (Photo by Jan Kruger - FIFA/FIFA via Getty Images) Full Article Area=Tournament Section=Competition Kind=Photo Tournament=FIFA U-17 World Cup India 2017
ea The trophy is pictured ahead of the FIFA U-17 World Cup India 2017 Final By www.fifa.com Published On :: Fri, 27 Oct 2017 16:26:00 GMT KOLKATA, INDIA - OCTOBER 27: The trophy is pictured ahead of the FIFA U-17 World Cup India 2017 Final match between England and Spain at Vivekananda Yuba Bharati Krirangan on October 27, 2017 in Kolkata, India. (Photo by Jan Kruger - FIFA/FIFA via Getty Images) Full Article Area=Tournament Section=Competition Kind=Photo Tournament=FIFA U-17 World Cup India 2017
ea The trophy is pictured ahead of the FIFA U-17 World Cup India 2017 Final By www.fifa.com Published On :: Fri, 27 Oct 2017 16:27:00 GMT KOLKATA, INDIA - OCTOBER 27: The trophy is pictured ahead of the FIFA U-17 World Cup India 2017 Final match between England and Spain at Vivekananda Yuba Bharati Krirangan on October 27, 2017 in Kolkata, India. (Photo by Jan Kruger - FIFA/FIFA via Getty Images) Full Article Area=Tournament Section=Competition Kind=Photo Tournament=FIFA U-17 World Cup India 2017
ea The trophy is pictured ahead of the FIFA U-17 World Cup India 2017 Final By www.fifa.com Published On :: Fri, 27 Oct 2017 16:28:00 GMT KOLKATA, INDIA - OCTOBER 27: The trophy is pictured ahead of the FIFA U-17 World Cup India 2017 Final match between England and Spain at Vivekananda Yuba Bharati Krirangan on October 27, 2017 in Kolkata, India. (Photo by Jan Kruger - FIFA/FIFA via Getty Images) Full Article Area=Tournament Section=Competition Kind=Photo Tournament=FIFA U-17 World Cup India 2017