Testing with Mocha – Kevin Wang – Medium

Testing with Mocha  #tdd #react #mocha #javascript #reactjs

  • js file and running “npm test” in the console.var assert = function() { describe(‘#indexOf()’, function() { it(‘should return -1 when the value is not present’, function() { assert.equal(-1, [1,2,3].
  • indexOf(4)); }); });});The test should pass and you should see the below.From the example above though, the function that the test is testing for is written in the same file.
  • toFixed(2) }, sleepApneaIncrease: function(amount){ return (amount * 1.06).
  • toFixed(2) }, heartDiseaseIncrease: function(amount){ return (amount * 1.17).
  • toFixed(2) }, checkCondition: function(amount, condition){ switch (condition) { case “Allergies”: return case “Sleep Apnea”: return case “Heart Disease”: return default: return 0; } }}I store them all in an object so thatI am able to export out and require them when I need to.

My first experience with Mocha is at Flatiron. When we were doing Javascript labs/work we used Mocha to test out the code that we wrote, it made sure that the results are as we expected. This was my…
Continue reading “Testing with Mocha – Kevin Wang – Medium”

React, JSX and ES6 as a template language – Korbit Engineering – Medium

React, JSX and ES6 as a template language @poksme  #Reactjs #JavaScript #ES6

  • React, JSX and ES6 as a template languageThe last few years have seen an important popularity increase of front-end rendering frameworks and what once was a cosmetic paint coating using handwritten HTML and CSS became an abstracted JavaScript process that renders HTML and CSS.
  • The benefits of client-side HTML rendering are plenty but one down side is the rise of complexity for web integrators.What used to be rendered on the server using a template language (here moustache)……became a very noisy JavaScript module…The majority of the content of this file is keywords and software development notions (module, object, function, point dereference…).
  • Using ES6 syntactic sugars and react functional component we can greatly reduce this noise.What happened here?
  • Technically speaking, we export as default an arrow function that destructures its only argument (props) and returns some JSX.
  • The result is a much more simple syntax closer to a template.But does this scale?The benefit of this notation is that we get a declarative block at the top of the file that lists the needed properties and a template block at the bottom that uses the properties.At Korbit we have been using this component style for hyphen.to.

The last few years have seen an important popularity increase of front-end rendering frameworks and what once was a cosmetic paint coating using handwritten HTML and CSS became an abstracted…
Continue reading “React, JSX and ES6 as a template language – Korbit Engineering – Medium”

Fullstack React: create-react-app

What is Create React App and how do I use it?  Day 12 of 🎄 30 Days of React 🎄   #reactjs

  • Lets create a new app well call 30days using the create-react-app command we just installed.
  • With create-react-app installed globally, well be able to use the create-react-app command anywhere in our terminal.
  • Open a Terminal window in a directory where you want to create your app.
  • In terminal, we can create a new React application using the command and adding a name to the app we want to create.
  • The package is released as a Node Package and can be installed using npm .

Today, we’re going to add a build process to store common build actions so we can easily develop and deploy our applications.
Continue reading “Fullstack React: create-react-app”

Symfony with React.js frontend Integration

  • Let’s start by installing Symfony
  • Now that we have a symfony installation, let’s begin with the part of react.js integration
  • Eveytime you access to “/” our “/{slug}” it will used react-router, the “/api/{slug}” it will use Symfony
  • I’ll add some demonstration code, that will allow you to see this example in action
  • Now that we have a npm project at the root of our Symfony installation, lets install the needed packages

Symfony with React.js frontend Integration – The Internet brave new World
Continue reading “Symfony with React.js frontend Integration”

Deploying a React Native App for iOS — pt. 1 – Medium

  • You will want to make sure that your Bundle Identifier is set to be your App ID, and select your device in the top left where the iOS version is selected.
  • In short: personal is easier to get started, but if you want to transition to a business account it can be time-consuming.
  • Last week I deployed a React Native iOS app to the App Store.
  • The two ways of running your app on your phone are ( 1.
  • Deploying a React Native App for iOS – pt.

Last week I deployed a React Native iOS app to the App Store. In total, the deployment process took about 2 hours — going through the…
Continue reading “Deploying a React Native App for iOS — pt. 1 – Medium”

skellock/ReactotronSlowlog.js Created Aug 26, 2016

@jondot Here’s your react-native-slowlog & how plugins work with the new Reactotron app.

  • // slowlog calls this on chatty things
  • // decorate `Reactotron` with a `slowlog` function
  • display ({ name : COMMAND , important : true , value, preview : value })
  • // return the reactotron plugin object
  • Sign up for a GitHub account Sign in

Read the full article, click here.


@skellock: “@jondot Here’s your react-native-slowlog & how plugins work with the new Reactotron app.”



skellock/ReactotronSlowlog.js Created Aug 26, 2016

How to create a React component to publish on NPM?

How to create a #ReactJS component to publish on NPM?

  • So we have our component package created and well tested.
  • When we have the project structure ready, we can start testing our component.
  • The generator is quite old and is missing some NPM packages.
  • When someone imports our component in their project it will use this file.
  • Apart from the component’s code, you can also find the index.js file in it.

Read the full article, click here.


@ReactiveConf: “How to create a #ReactJS component to publish on NPM?”


In the blog post I am explaining how to create the React component as a library to publish on NPM (Node Package Manager).


How to create a React component to publish on NPM?