JSK Weekly is out. Come and see the best stories of the past week #javascript #reactjs

JSK Weekly is out. Come and see the best stories of the past week  #javascript #reactjs

  • JavaScript modules are with us.
  • Browsers implement them natively, and now Node.js decided to introduce them using *.
  • Johannes Ewald writes about the current state of JavaScript modules, including browser implementations, Webpack, Node.js changes, what does it means for library creators, users, etc.
  • If you are still struggling with parallelism and concurrency, take a look at Jonathan Martin’s article on elegant concurrency patterns in JavaScript.
  • Also big news last week was the release of Node.js 8 which includes npm version 5, a new version of V8 engine with significant performance optimizations, native add-ons support, buffer changes, and much more.

JavaScript modules are with us. Browsers implement them natively, and now Node.js decided to introduce them using *.mjs extension which caused quite a stir in the community. Johannes Ewald writes about the current state of JavaScript modules, including browser implementations, Webpack, Node.js changes, what does it means for library creators, users, etc.

Jake Archibald has a great article on HTTP/2 push specification where he takes a deeper look into it and the problems with the various browser implementations.

If you are still struggling with parallelism and concurrency, take a look at Jonathan Martin’s article on elegant concurrency patterns in JavaScript. He covers event loop, promise chaining, async functions, parallel execution and other topics.

Also big news last week was the release of Node.js 8 which includes npm version 5, a new version of V8 engine with significant performance optimizations, native add-ons support, buffer changes, and much more. We have several articles covering the new features.

Continue reading “JSK Weekly is out. Come and see the best stories of the past week #javascript #reactjs”

Reducing React jank with (possibly hacky) use of WeakMap

Reducing React jank with (possibly hacky) use of WeakMap  #reactjs #javascript

  • You’ve heard that React’s Virtual DOM implement will help keep your UI snappy and snappy UI is exactly what will give your customers a warm happy glow inside.You’ve just written the first version of your code to test out your ideas:class List extends PureComponent { onClick () { //… } onUpdate (item, updatedValue) { //… } onMouseOver (item) { //… } render () { return ( div onClick={() = this.onClick()} { this.props.items.map((item) = ( Item key={item.id} item={item} onMouseOver={() = this.onMouseOver(item)} onUpdate={(value) = this.onUpdate(item, value)} / )) } /div ) }}class Item extends PureComponent { render () { const { item, onUpdate, …rest } = this.props return ( div {…rest} input type=”text” value={item.value} onChange={(e) = onUpdate(e.target.value)} / /div ) }}You know that React creates a representation of your components and uses it to efficiently update the browser when you provide a new version of this view.You understand that, whilst its generally more than sufficient in most cases, in some cases you want to improve the performance by using PureComponents to tell React which parts have not changed.You’ve put in the key attribute for all your items, which should give a hint to React as to which items match to which.You’ve used ImmutableJS for your state so the shallow compare algorithm that PureComponent uses will be fast and efficient.However you find that its still not helping, and every update still takes longer than you think it should.sooooo slowTo help you debug, you’ve installed the React DevTools for Chrome / Firefox.You click on the little checkbox on the top left corner called ‘Trace React Updates’, which will flash a border around any component that was just updated.With this feature switched on, you notice that, even though you’ve been a good little front-end developer and have done all the performance best practices, each Item is still being updated every time you type.Not what was expectedYou expected that only the Item thats changed should have a flashing border.You search the internet for information and realise, “Duh I’m creating a new function every time I re-render List, even though the item itself didn’t change”.
  • You start by changing the `onClick` handler for the `List` componentclass List extends PureComponent { constructor () { this.onClick = this.onClick.bind(this) } onClick () { //… } //… render () { return ( div onClick={this.onClick} //… /div ) }}Better yet, you remembered there’s the class instance fields proposal, which allows you to define your onClick handler as an arrow function!
  • What to do…You could refactor the Item component so that every event handler is given the item as one of the arguments:class List extends PureComponent { //… render () { return ( div onClick={this.onClick} { this.props.items.map((item) = ( Item key={item.id} item={item} onMouseOver={(e, item) = this.onMouseOver(item)} onUpdate={(item, value) = this.onUpdate(item, value)} / )) } /div ) }}class Item extends PureComponent { render () { const { item, onMouseOver, onUpdate, …rest } = this.props return ( div onMouseOver={(e) = onMouseOver(e, item)} {…rest} input type=”text” onChange={(e) = onUpdate(item, e.target.value)} value={item.value} / /div ) }}Whilst this feels okay for the onUpdate handler, it feels wrong wrapping every possible DOM event handler that the consumer of your Item component could possibly need.You try another approach.
  • This way, only when an item has not been seen before will a new function reference be created:class List extends PureComponent { itemEventHandlers = new WeakMap() getItemEventHandler = (item) { return } const eventHandlers = { onUpdate: (value) = { //… }, onMouseOver: () = { //… } } eventHandlers) return eventHandlers } //… render () { return ( div onClick={this.onClick} { this.props.items.map((item) = ( Item key={item.id} item={item} / )) } /div ) }}You use a WeakMap so you don’t have to manually track when an item is no longer needed and thus its corresponding functions can be garbage collected.
  • Ah the beauty of weak references.You think, “Hey, why not just store the whole Item component instead of just the event handlers so the render function of the List component is even more efficient”:class List extends PureComponent { itemCache = new WeakMap() renderItemComponent = (item) { if(this.itemCache.has(item)){ return this.itemCache.get(item) } const component = ( Item key={item.id} item={item} onUpdate={(value) = {}} onMouseOver={() = {}} / ) this.itemCache.set(item, component) return component } onClick = () { //… } render () { return ( div onClick={this.onClick} { } /div ) }}Your code now does what you expect it to; Each Item updating only if its item has changed.When you go to check React DevTools though, all the `Item` components are still flashing.It works fast now, but DevTools still not showing what you expect.Looking closer, you notice that only the inner icon for the component you’ve changed blinks.

Say you’re building a new application. This application is going to be the thing that updates your company’s product experience to the latest and greatest. You/your designers have mocked up an…
Continue reading “Reducing React jank with (possibly hacky) use of WeakMap”

At a glance: React Native for building apps

A brief intro to building apps with React Native  by Luis Pinto

  • React Native is a framework for building native apps using React and JavaScript.
  • Thousands of apps are using React Native, from established Fortune 500 companies to hot new startups.
  • As I said before, React Native is an open source platform, and apps that use open source modules for React are quite common.
  • During the process of creating this color wheel, my team and I developed this open source package for everyone who wants to create a dial on React Native.
  • From my point of view, React Native will be one of the frameworks companies will use for building their native apps in the near future.

Learn more about React Native, a framework for building native apps using React and JavaScript.
Continue reading “At a glance: React Native for building apps”

Which should I learn – Angular 2 or React?

Which should I learn – #Angular 2 or #React ?  #reactjs #php

  • It’s one of the biggest disadvantages of this framework according to a lot of Angular programmers.
  • To sum it up
  • React ranks among the lightest on the market.
  • Regardless of how powerful a framework is, for you what really matters is how quickly you can start selling your skills.
  • Version to version, there are many modifications and it’s probably not going to change any time soon.

Dostarczamy najwyższej jakości oprogramowanie, a nasza specjalność to projekty eCommerce oraz aplikacje webowe w PHP i Ruby.
Continue reading “Which should I learn – Angular 2 or React?”

Breaking Changes · facebook/react-native Wiki · GitHub

  • ### New breaking change – **Who does this affect**: – **How to migrate (shown by `react-native upgrade`)**: – **Why make this breaking change**: – **Severity (people affected x amount of work for them)**:
  • Why make the breaking change : Fixes a bug.
  • Why make the breaking change: Resizing is the correct behavior on Android.
  • Not sure if breaking change, we only know of product code this fixed, not broke.
  • Why make the breaking change: Fixes wrong behavior – makes this behave the same as on the web.

react-native – A framework for building native apps with React.
Continue reading “Breaking Changes · facebook/react-native Wiki · GitHub”

admin-on-rest 0.5 is out

  • To determine the column header, or the form label, Fields and Inputs components now use the source when there is no label .
  • Admin-on-rest is smart enough to “humanize” the source so that it is readable by a human.
  • You should now be able to write complete admins without ever looking at the components source.
  • Although you can create a REST client function of your own, when all you need is to add custom headers to all the requests sent by admin-on-rest, it’s cumbersome to duplicate the existing code of simpleRestClient .
  • [BC Break] Remove credentials: include header enabled by default


Published on 10 November 2016

by François Zaninotto

with tags admin-on-rest ng-admin ReactJS open source

Continue reading “admin-on-rest 0.5 is out”

Do you feel a bit unsure about the latest technical jargon? Here is the answer.

#reactjs #WebRTC #Dotnet Unsure about the latest #tech #jargon? Here is a brief answer

  • Strikersoft has also used React Native , which lets developers use JavaScript to build mobile apps that use the same fundamental UI building blocks as standard iOS and Android apps.
  • WebRTC is a set of APIs used to add high-quality, real-time voice, video, messaging and P2P file transfer to mobile applications and web solutions.
  • Native applications have the best opportunities to access phone hardware and to create the best possible user experience in for instance eHealth applications used by doctors.
  • Databases are software that allow applications to store data in a structured way, making them easy to retrieve when needed.
  • Strikersoft has used WebRTC in several projects to add real-time communication capabilities to both mobile applications and web solutions.

React (sometimes called React.js) is an open source JavaScript library for building user interfaces that was originally created by Facebook. It was first used in Facebook’s newsfeed in 2011, and was open-sourced in 2013. Facebook built React to make it easier to build large applications in which data change over time.
Continue reading “Do you feel a bit unsure about the latest technical jargon? Here is the answer.”