JavaScript Arrays — Finding The Minimum, Maximum, Sum, & Average Values

  • Math.min() , as expected, returns the smallest of any set of given numbers.
  • The problem with Math.min() is it expects each parameter to be input separately and cannot take an array of multiple numbers as input.
  • min([1,2,3,4])// NaNAs you can see, Math.min() only works when each number is input as a separate parameter.Because of this, we need to make use of the …spread operator.
  • The spread operator allows an expression to be expanded in places where multiple elements/variables/arguments are expected.When we use the spread operator within Math.min() it will expand, or spread out, our array and insert each variable as a separate parameter into Math.min()!
  • In other words: Math.min(…[1,2,3,4]) is the same as Math.min(1,2,3,4)Finally, all I’ve done with the code above is turned it into a function expression utilizing arrow functions.

In this article we’ll explore four plug and play functions that allow you to easily find certain values in an arrays of numbers. Specifically we’ll explore the following: Math is a built in object in…
Continue reading “JavaScript Arrays — Finding The Minimum, Maximum, Sum, & Average Values”

We’re ready for your Lightning Talks submissions – React Day Berlin – Medium

You still have a chance to join our speakers on stage:  #ReactJS

  • We’re ready for your Lightning Talks submissionsReact Day Berlin forecast: 🌩 A chance of snow and thunderous applauseReact developers sometimes have to deal with tough situations, but making small talk with your fellow geeks has never been one of them.
  • Do you have a project you’d like to discuss with / pitch to an audience but a full talk would be too much for now?
  • React Day Berlin is ready for you, anyway.📩 Submit your Lightning TalkAs always, all winning speakers will get to attend React Day Berlin for free.
  • We’ll pick 4 of all proposals that’ll make the most sense in our lineup.Local developers and React newbies are especially welcome to submit.
  • In case you need help figuring out and fine-tuning your talk, we’re here for you.Each talk is limited to 5–7 minutes without QA.All winning proposals will be published on our website and here on Medium and also promoted through our social channels.Talks are subject to the Berlin Code of Conduct….

React developers sometimes have to deal with tough situations, but making small talk with your fellow geeks has never been one of them. Well, there’s no need to discuss the weather when the scene is…
Continue reading “We’re ready for your Lightning Talks submissions – React Day Berlin – Medium”

We’re ready for your Lightning Talks submissions – React Day Berlin – Medium

We're ready for your 🌩 Lightning Talks submissions!  #ReactJS #ReactDayBerlin

  • We’re ready for your Lightning Talks submissionsReact Day Berlin forecast: 🌩 A chance of snow and thunderous applauseReact developers sometimes have to deal with tough situations, but making small talk with your fellow geeks has never been one of them.
  • Do you have a project you’d like to discuss with / pitch to an audience but a full talk would be too much for now?
  • React Day Berlin is ready for you, anyway.📩 Submit your Lightning TalkAs always, all winning speakers will get to attend React Day Berlin for free.
  • We’ll pick 4 of all proposals that’ll make the most sense in our lineup.Local developers and React newbies are especially welcome to submit.
  • In case you need help figuring out and fine-tuning your talk, we’re here for you.Each talk is limited to 5–7 minutes without QA.All winning proposals will be published on our website and here on Medium and also promoted through our social channels.Talks are subject to the Berlin Code of Conduct….

React developers sometimes have to deal with tough situations, but making small talk with your fellow geeks has never been one of them. Well, there’s no need to discuss the weather when the scene is…
Continue reading “We’re ready for your Lightning Talks submissions – React Day Berlin – Medium”

How to Style React Components with styled-component

  • With components, it has started to make more sense to include styling inline within a component like so:source: www.styled-components.comWhy Inline Styling?You may be thinking to yourself, isn’t inline styling bad practice?
  • In the case of components though, inline styling has many advantages over vanilla CSS styling.
  • Acording to Radium’s website (another tool for inline styling) the benefits of using inline styling with components are:Scoped styles without selectors (styles are on component itself)Avoids specificity conflicts (two style definitions for one element)Source order independence (doesn’t rely on the order files are imported)Dead code elimination (no unused classes as in CSS)Highly expressive (easier to read JSX)Original using styled-components— cool.
  • extend“ syntax.Styling with styled-componentsResulting WebpageFinishing UpInline styling of components is a powerful option to consider when building out user interfaces with React.
  • There is a lot more that styled-components is capable of and I recommend looking through there tutorials and guides to get a better understanding of how awesome inline styling of your components can be!

Traditional styling of websites relies on having an external stylesheet with CSS. This tradition has been challenged with the advent of React and component based UI design. With components, it has…
Continue reading “How to Style React Components with styled-component”

Organizing Tests in Jest – Jeff Lombard – Medium

Organizing Tests in Jest  #jest #javascript #react #softwaretesting #reactjs

  • This includes organization.I’ve seen two popular ways suggested for organizing tests in Jest:Putting all of your test code into a neatly organized /tests directory.Putting your test code next to the files they are testing.Both of these suggestions are valid, but to have the elegance of a master craftsman, we should consider the level of the test that is being written.Testing LevelsThere are many testing levels, but for simplicity we’re just going to talk about two here.
  • “Unit testing refers to tests that verify the functionality of a specific section of code, usually at the function level.
  • |- /main| |- index.js| |- index.test.jsIntegration tests run against many lines of code in many files.
  • So include the type of test right in the name of the and api.int.test.jsConclusionAn ideal set up would look something like this:|- /main| |- index.js| |- index.unit.test.js|- /supporting| |- fetch.js|- /tests| |- /int| | |- api.int.test.jsThat way you can easily find your tests.
  • For unit testing run jest unit and for integration testing run jest int.As with anything, there is no single way of doing this.

If you haven’t already tried out Jest, you should. Even if you’re not using React. It’s dead simple and loaded with some cool features like snapshot testing. Jest does a great job of keeping reports…
Continue reading “Organizing Tests in Jest – Jeff Lombard – Medium”

Nishant Agrwal’s response to Why isn’t React called framework? What does it lack to be a framework?

Why isn't React called framework? ⚛  #ReactJS #JavaScript @reactjs

  • It is a framework in the sense that it absolutely does have a predefined architecture and infrastructural design and it calls into your code to fill in the details.
  • It is the framework code that runs first and that calls into your code to determine what has to be done at a high level.
  • The difference between a library and a framework has to do with Inversion of Control .
  • The code written by the user of a framework just defines in an abstract way the specifics of that particular application.
  • At the end of the day it is more important to understand how React is different from the classic examples of either a library or a framework.

Why isn’t React called framework? What does it lack to be a framework?
Continue reading “Nishant Agrwal’s response to Why isn’t React called framework? What does it lack to be a framework?”

gaearon comments on feedback on my first redux app

  • It doesn’t make sense to me to use Redux if all your app does is fetch something on a single page.
  • subreddit: subreddit find submissions in “subreddit” author: username find submissions by “username” site: example.com find submissions from “example.com” url: text search for “text” in url selftext: text search for “text” in self post contents self:yes (or self:no) include (or exclude) self posts nsfw:yes (or nsfw:no) include (or exclude) results marked as NSFW
  • It’s not, there are more compact and less verbose ways to use it in smaller apps.
  • If your end goal is only to fetch data in a React app then this is an unnecessarily verbose and complicated way to do it.
  • react-tubular : React Library To Make Youtube video as HTML page background

Let me preface this by saying this looks correct aside from minor nitpicks. Congratulations on learning the basics of Redux! Not meaning to…
Continue reading “gaearon comments on feedback on my first redux app”

Class transform with property initializer by keyanzhang · Pull Request #54 · reactjs/react-codemod · GitHub

  • To sum up the todos I found so far.
  • import React from ‘ react ‘ ; class App extends React .
  • ‘ use strict ‘ ; var React = require ( ‘ react ‘ ) class Loader extends React .
  • keyanzhang added some commits Jun 8, 2016
  • ‘ use strict ‘ ; var React = require ( ‘ react ‘ ); const mixins = [ClassNameMixin, PureRenderMixin] var Loader = React .

Read the full article, click here.


@dan_abramov: “Words fail to describe how cool this codemod by @keyanzhang is. createClass + PropTypes => ES6 + properties + Flow!”


react-codemod – React codemod scripts


Class transform with property initializer by keyanzhang · Pull Request #54 · reactjs/react-codemod · GitHub

Pluralsight

Take an objective look at Facebook’s React.js library. Register here and join us on 6/23:

  • Carlos Souza is a course instructor at Code School.
  • When he is not typing code at Code School, you may find him speaking at or attending conferences.
  • Working on ES2015, React, Node and Ruby on Rails content for Code School, Carlos has years of experience as a full-stack developer and regularly speaks at conferences and community meetups.
  • Sergio Cruz is an application developer who is passionate about learning and sharing knowledge.
  • We’ll compare React.js to popular alternatives like Angular and jQuery to show why it may make sense for your team to start using React.js in your front-end workflow.

Read the full article, click here.


@pluralsight: “Take an objective look at Facebook’s React.js library. Register here and join us on 6/23:”


There are a seemingly endless number of new JavaScript frameworks and libraries to pay attention to and it’s often hard to decide which one is best for your project or workflow. In this screencast, we take an objective look at Facebook’s React.js library and explore its learning curve, performance, and real-world uses by businesses like Paypal and Airbnb. We’ll compare React.js to popular alternatives like Angular and jQuery to show why it may make sense for your team to start using React.js in your front-end workflow.


Pluralsight