My first ReactJS app from scratch

ReactJS is a JavaScript library for developing user interfaces (UIs) which efficiently update when your data changes

ReactJS apps are very performant since ReactJS uses a virtual DOM which is a JavaScript object representing the regular DOM. The virtual DOM is much faster than the regular DOM

To install ReactJS on your computer open a command line and type:

$ npm install -g create-react-app

Proceed to create a new ReactJS project:

$ create-react-app myProject

Change to the directory where you just created your new ReactJS project and type:

$ cd myProject

$ npm start

to launch the developer server and open your localhost on port 3000 i.e. (http://localhost:3000)

Today we are going to write a small ReactJS app with a + and – button to add and to substract 1 to a counter:

 

What is XSLT?

XSLT stands for Extensible Stylesheet Language Transformation and is used to convert XML documents to other formats such as XML, HTML or text, to extract individual parts of an XML document, and to create an XML document from different XML documents

XSLT uses the <xsl:template> element which has a macth attribute with a XPath expression to navigate through the XML document, for example, match=’/’ would select all elements that are direct children of the root element

Basics of XML

XML stands for Extensible Markup Language and is a hierarchically structured document consisting of nested tags that resemble HTML tags.

XML does not mean less storage space or quick access to information. However, XML lets you declare your own tags and is platform independent.

XML also enables the design of domain-specific markup language because namespaces are supported. Here is an example:

My first bundle with Webpack 4

Webpack is a open-source bundler for web assets like CSS or JavaScript files

To install Webpack you will need NPM to be installed on your computer or any similar package manager like Yarn.

Open a command line and go to the root directory of your project, then run

C:\>xampp\htdocs\webpack-project>npm install webpack –save-dev

 

Proceed to install CLI

C;\>xampp\htdocs\webpack-project>npm install –save-dev webpack-cli

 

Now create a package.json file in the root of your project directory with the following contents

package.json

Create also a webpack.config.js file in the root of your project directory with the following contents

webpack.config.js

Create a new folder named assets and a new folder named js in the assets folder with the following Javascript file

index.js

Create a HTML File which we will use later to see if everything works fine

Open a command line and go to the root directory of your project, then run:

C:\>xampp\htdocs\webpack-project>npm run build

 

Run also:

C:\>xampp\htdocs\webpack-project>npm run watch

 

for Webpack to create a new bundle everytime changes are made to the JavaScript file

Finnaly click the Click me button and an alert box should be displayed if everything is working fine

Configuring your web server with .htaccess

A .htaccess file helps you to configure your web server, such as the Apache web server.

In a .htaccess file, you can declare rewrite rules, prevent image hotlinking, handle bad http requests (404 Not Found), and so on.

You can even use htaccess for basic authentication along with a .htpassword file where you can store usernames and passwords.

The configuration in the .htaccess file affects the current directory including its subdirectories. You can override the .htaccess file in the subdirectories by simply declaring another .htaccess file

Here are some examples:

Handle a bad request (404 Not Found)

.htaccess

Use htaccess for basic authentication (Grant access only to user: gunther with password: today)

.htaccess

.htpasswd

Redirect all requests to news/url to news.php?url=url

What is Bootstrap?

Bootstrap is the most popular front-end framework for building responsive, mobile-first apps.

JavaScript Object Literals

An object literal is a comma-separated list of name-value pairs wrapped in curly braces. Object Literals can contain others Object Literals, Arrays and Functions.

Connecting to a MySQL Database with the PHP library PDO

PDO stands for PHP Data Objets and support Prepared Statements

you can also use the bindParam method, like:

What is PHP?

PHP is a server-side programming language for websites. PHP along with MySQL are powerful tools for developing back-end applications

What is ECMAScript 6 or ES6?

ECMAScript 6 (ES6) is the specification or standard followed by many programming languages like JavaScript, JScript, ActionScript, etc. The most popular programmimg language following this specification is JavaScript, That is why many people call ECMAScript 6 JavaScript 6

New features introduced in ECMAScript 6:

The let statement allows you to declare a variable with block scope

The const statement allows you to declare a constant

ES6 allows function parameters to have default values:

Introduces a row of new methods like:

Array.find()
Array.findIndex()
Number.isInteger()
Number.isSafeInteger()

Introduces a row of new properties like:

EPSILON
MIN_SAFE_INTEGER
MAX_SAFE_INTEGER