Optional Chaining Operator in JavaScript – Bene Studio

  • var user = { name: ‘Joe’ } – var zip = user.address.zip // ⚡⚡⚡Uncaught TypeError: Cannot read property ‘zip’ of undefinedIn this example we expect user.address.zip to exist but for some reason the address is missing from the user object.
  • Workaround #1: Logic Expressionsvar user = { name: ‘Joe’ } – var zip = user – user.address – user.address.zipNoisy and verbose.
  • Workaround #2: Ternary Operatorsvar user = { name: ‘Joe’ } – var zip = – user === undefined – ?
  • Workaround #3: Try-Catchvar user = { name: ‘Joe’ } – var ziptry { – zip = user.address.zip – } catch (error) { – zip = null – }Breaks control and has own scopes.
  • bin/babel index.jsThe Transpiled CodeTranspiled version of the index.js above: – var _user$address;var user = { – name: ‘Joe’ – };var zip = – user == null – ?

All of us usually confronts the situation where an expected member of a property chain is undefined or null. In this example we expect user.address.zip to exist but for some reason the address is…
Continue reading “Optional Chaining Operator in JavaScript – Bene Studio”

nohoist in Workspaces

  • First, let’s take a quick tour on how hoist work in standalone projects: – – To reduce redundancy, most package managers employ some kind of hoisting scheme to extract and flatten all dependent modules, as much as possible, into a centralized location.
  • In such project, modules could be scattered in multiple locations: – – yarn workspaces can share modules across child projects/packages by hoisting them up to their parent project’s node_modules: .
  • Consequently, workspaces developers often witness “module not found” related errors when building from the child project: – – For this monorepo project to reliably find any module from anywhere, it needs to traverse each nodemodules tree: *“monorepo/nodemodules”* and .
  • There are indeed many ways library owners can address these issues, such as multi-root, custom module map, clever traversing scheme, among others… However, – – It is frustrating when a solution worked for a standalone project only fell short in the monorepo environment.
  • Module path is a virtual path of the dependency tree, not an actual file path, so no need to specify “node_modules” or “packages” in the nohoist pattern.

As wonderful as yarn workspaces are, the rest of the community hasn’t yet fully caught up with the monorepo hoisting scheme. The introducing of the nohoist i…
Continue reading “nohoist in Workspaces”

New context API by acdlite · Pull Request #11818 · facebook/react · GitHub

  • Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
  • Already on GitHub?
  • Sign in to your account

react – A declarative, efficient, and flexible JavaScript library for building user interfaces.
Continue reading “New context API by acdlite · Pull Request #11818 · facebook/react · GitHub”

Top JavaScript Libraries & Tech to Learn in 2018 – JavaScript Scene – Medium

Top #JavaScript Libraries & Tech to Learn in 2018:  by @_ericelliott #ReactJS

  • There are still lots of developers working on Angular code bases, which shows up in Google trends:But as React continues to win customer satisfaction surveys, React growth has left Angular (and everything else) in the dust.What About Vue.js?
  • Vue.js is going to have a much harder time stealing users from React than they are having stealing users from jQuery and Angular.There’s plenty of room for Vue.js to pick up a lot of Angular and jQuery users at a fast clip, but they will likely hit a brick wall…
  • Why so Much Interest in React?Browsing through the React job listings, I noticed an interesting trend — a lot of them were for things that we don’t think of as front-end web work:React Native (for perspective, there are more of these openings than the total number of Vue.js openings)React for IoTReact for AR/VR…
  • In fact, I found quite a few React job listings that didn’t even mention JavaScript.React also offers a rich, vibrant ecosystem piggybacking on React’s de-facto standards — something the JavaScript world hasn’t seen since jQuery plugins ruled the web.The question is no longer “which framework?”
  • We have a great framework to build apps on now, and there’s a great ecosystem settling in around React.Which Topics Should You Study?Like last year, you can’t go wrong focusing on the essentials, but you should place more emphasis on functional programming for React apps.React is great for two primary reasons:Deterministic…

Last year, I wrote an article rounding up the top tech to learn in 2017. This year there are some surprises. First, software ate the world, the web ate software, and JavaScript ate the web. In 2018…
Continue reading “Top JavaScript Libraries & Tech to Learn in 2018 – JavaScript Scene – Medium”

Taking Gatsby for a spin

Taking Gatsby for a spin  #webdev #javascript #reactjs #Flexi_IT

  • It’s not that I really need a new tool to create static sites, it’s just that every developer tweeting about Gatsby seems to think it’s the most exciting thing on the web since they learned they could combine the and tag.
  • Here are some of the important features of Gatsby: – – GatsbyJS is based on React which means that you’ll be writing almost everything in JavaScript / JSX.
  • If you already like React, you’ll most definitely enjoy creating static sites with Gatsby.
  • Gatsby comes with plugins to pull in data from several APIs, CMS systems and local files.
  • PRPL + the gatsby offline plugin mean that your site will be considered a PWA, will load insanely fast on any device and scores great in Google lighthouse.

A short write-up on Gatsby, a static site generator based on React
Continue reading “Taking Gatsby for a spin”

Cosmic JS vs. WordPress – Hacker Noon

  • Cosmic JS vs. WordPressCosmic JS vs. WordPress for Content ManagementCosmic JS is an API-first CMS that helps teams of developers and content editors build apps faster.
  • Wondering what makes Cosmic JS a more suitable CMS backend for you?Cosmic JS offers an intuitive API that can deliver content to any website or application.
  • Cosmic JS is more productiveInstalled content management systems create ongoing technical debt which becomes tomorrow’s problem.
  • Cosmic JS is an API-first content management platform so we take care of maintenance, security and scalability for you.Content stored in Cosmic JS and delivered by the API is protected with 256-bit SSL encryption.
  • You can also restrict access to your content by adding optional access tokens located in the Settings tab in your Cosmic JS Bucket.ConclusionLegacy content management systems are not equipped to handle the speed of modern business.

Cosmic JS is an API-first CMS that helps teams of developers and content editors build apps faster. 64.5% of developers surveyed on StackOverflow stated that WordPress was one of their most dreaded…
Continue reading “Cosmic JS vs. WordPress – Hacker Noon”