Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
React Cookbook
React Cookbook

React Cookbook: Create dynamic web apps with React using Redux, Webpack, Node.js, and GraphQL

eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

React Cookbook

Working with React

In this chapter, the following recipes will be covered:

  • Introduction
  • Working with the latest JS features in React
  • What's new in React?
  • Using React on Windows

Introduction

React is a JavaScript library (MIT License) made by Facebook to create interactive UIs. It's used to create dynamic and reusable components. The most powerful thing about React is that can be used in the client, server, mobile applications, and even VR applications. 

In the modern web, we need to manipulate the DOM constantly; the problem is that doing this a lot may affect the performance of our application seriously. React uses a Virtual DOM, which means that all updates occur in memory (this is faster than manipulating the real DOM directly). The learning curve of React is short in comparison with other JavaScript frameworks such as Angular, Vue, or Backbone, mainly because the React code is mostly written with modern JavaScript (classes, arrow functions, string templates, and so on) and does not have too many patterns used to write code, like Dependency Injection, or a template system, like in Angular.

Companies such as Airbnb, Microsoft, Netflix, Disney, Dropbox, Twitter, PayPal, Salesforce, Tesla, and Uber are extensively using React in their projects. In this book, you will learn how to develop your React applications in the way they do, using best practices.

Working with the latest JS features in React

As I said in the introduction, React is mainly written with modern JavaScript (ES6, ES7, and ES8). If you want to take advantage of React, there are some modern JS features that you should master to get the best results for your React applications. In this first recipe, we are going to cover the essential JS features so you are ready and can start working on your first React application.

How to do it...

In this section, we will see how to use the most important JS features in React:

  1. let and const: The new way to declare variables in JavaScript is by using let or const. You can use let to declare variables that can change their value but in block scope. The difference between let and var is that let is a block scoped variable that cannot be global, and with var, you can declare a global variable, for example:
    var name = 'Carlos Santana';
let age = 30;

console.log(window.name); // Carlos Santana
console.log(window.age); // undefined
  1. The best way to understand "block scope" is by declaring a for loop with var and let. First, let's use var and see its behavior:
    for (var i = 1 ; i <= 10; i++) {
console.log(i); // 1, 2, 3, 4... 10
}

console.log(i); // Will print the last value of i: 10
  1. If we write the same code, but with let, this will happen:
    for (let i = 1 ; i <= 10; i++) {
console.log(i); // 1, 2, 3, 4... 10
}

console.log(i); // Uncaught ReferenceError: i is not defined

  1. With const, we can declare constants, which means the value can't be changed (except for arrays and objects):
    const pi = 3.1416;
pi = 5; // Uncaught TypeError: Assignment to constant variable.
  1. If we declare an array with const, we can manipulate the array elements (add, remove, or modify elements):
    const cryptoCurrencies = ['BTC', 'ETH', 'XRP'];

// Adding ERT: ['BTC', 'ETH', 'XRP', 'ERT'];
cryptoCurrencies.push('ERT');

// Will remove the first element: ['ETH', 'XRP', 'ERT'];
cryptoCurrencies.shift();

// Modifying an element
cryptoCurrencies[1] = 'LTC'; // ['ETH', 'LTC', 'ERT'];
  1. Also, using objects, we can add, remove, or modify the nodes:
    const person = {
name: 'Carlos Santana',
age: 30,
email: '[email protected]'
};

// Adding a new node...
person.website = 'https://www.codejobs.com';

// Removing a node...
delete person.email;

// Updating a node...
person.age = 29;

  1. Spread operator: The spread operator (...) splits an iterable object into individual values. In React, it can be used to push values into another array, for example when we want to add a new item to a Todo list by utilizing setState (this will be explained in the next chapter):
    this.setState({
items: [
...this.state.items, // Here we are spreading the current items
{
task: 'My new task', // This will be a new task in our Todo list.
}
]
});
  1. Also, the Spread operator can be used in React to spread attributes (props) in JSX:
    render() {
const props = {};

props.name = 'Carlos Santana';
props.age = 30;
props.email = '[email protected]';

return <Person {...props} />;
}
  1. Rest parameter: The rest parameter is also represented by .... The last parameter in a function prefixed with ... is called the rest parameter. The rest parameter is an array that will contain the rest of the parameters of a function when the number of arguments exceeds the number of named parameters:
    function setNumbers(param1, param2, ...args) {
// param1 = 1
// param2 = 2
// args = [3, 4, 5, 6];
console.log(param1, param2, ...args); // Log: 1, 2, 3, 4, 5, 6
}

setNumbers(1, 2, 3, 4, 5, 6);

  1. Destructuring: The destructuring assignment feature is the most used in React. It is an expression that allows us to assign the values or properties of an iterable object to variables. Generally, with this we can convert our component props into variables (or constants):
    // Imagine we are on our <Person> component and we are 
// receiving the props (in this.props): name, age and email.
render() {
// Our props are:
// { name: 'Carlos Santana', age: 30, email:
'[email protected]' }
console.log(this.props);
const
{ name, age, email } = this.props;

// Now we can use the nodes as constants...
console.log(name, age, email);

return (
<ul>
<li>Name: {name}</li>
<li>Age: {age}</li>
<li>Email: {email}</li>
</ul>
);
}

// Also the destructuring can be used on function parameters
const Person = ({ name, age, email }) => (
<ul>
<li>Name: {name}</li>
<li>Age: {age}</li>
<li>Email: {email}</li>
</ul>
);
  1. Arrow functions: ES6 provides a new way to create functions using the => operator. These functions are called arrow functions. This new method has a shorter syntax, and the arrow functions are anonymous functions. In React, arrow functions are used as a way to bind the this object in our methods instead of binding it in the constructor:
    class Person extends Component {
showProps = () => {
console.log(this.props); // { name, age, email... }
}

render() {
return (
<div>
Consoling props: {this.showProps()}
</div>
);
}
}
  1. Template literals: The template literal is a new way to create a string using backticks (` `) instead of single quotes (' ')   or double quotes (" "). React use template literals to concatenate class names or to render a string using a ternary operator:
    render() {
const { theme } = this.props;

return (
<div
className={`base ${theme === 'dark' ? 'darkMode' :
'lightMode'}`}
>
Some content here...
</div>
);
}
  1. Map: The map() method returns a new array with the results of calling a provided function on each element in the calling array. Map use is widespread in React, and is mainly used to render multiple elements inside a React component; for example, it can be used to render a list of tasks:
    render() {
const tasks = [
{ task: 'Task 1' },
{ task: 'Task 2' },
{ task: 'Task 3' }
];

return (
<ul>
{tasks.map((item, key) => <li key={key}>{item.task}</li>}
</ul>
);
}

  1. Object.assign(): The Object.assign() method is used to copy the values of all enumerable own properties from one or more source objects to a target object. It will return the target object. This method is used mainly with Redux to create immutable objects and return a new state to the reducers (Redux will be covered in Chapter 5, Mastering Redux):
    export default function coinsReducer(state = initialState, action) {
switch (action.type) {
case FETCH_COINS_SUCCESS: {
const { payload: coins } = action;

return Object.assign({}, state, {
coins
});
}

default:
return state;
}
};
  1. Classes: JavaScript classes, introduced in ES6, are mainly a new syntax for the existing prototype-based inheritance. Classes are functions and are not hoisted. React uses classes to create class Components:
    import React, { Component } from 'react';

class Home extends Component {
render() {
return <h1>I'm Home Component</h1>;
}
}

export default Home;
  1. Static methods: Static methods are not called on instances of the class. Instead, they're called on the class itself. These are often utility functions, such as functions to create or clone objects. In React, they can be used to define the PropTypes in a component:
    import React, { Component } from 'react';
import PropTypes from 'prop-types';
import logo from '../../images/logo.svg';

class Header extends Component {
static propTypes = {
title: PropTypes.string.isRequired,
url: PropTypes.string
};

render() {
const {
title = 'Welcome to React',
url = 'http://localhost:3000'
} = this.props;

return (
<header className="App-header">
<a href={url}>
<img src={logo} className="App-logo" alt="logo" />
</a>
<h1 className="App-title">{title}</h1>
</header>
);
}
}

export default Header;
  1. Promises: The Promise object represents the eventual completion (or failure) of an asynchronous operation and its resulting value. We will use promises in React to handle requests by using axios or fetch; also, we are going to use Promises to implement the server-side rendering (this will be covered in Chapter 11, Implementing Server-Side Rendering).
  2. async/await: The async function declaration defines an asynchronous function, which returns an AsyncFunction object. This also can be used to perform a server request, for example using axios:
    Index.getInitialProps = async () => {
const url = 'https://api.coinmarketcap.com/v1/ticker/';
const res = await axios.get(url);

return {
coins: res.data
};
};

What's new in React?

This paragraph was written on August 14, 2018, and the latest version of React was 16.4.2. The React 16 version has a new core architecture named Fiber. 

In this recipe, we will see the most important updates in this version that you should be aware of to get the most out of React.

How to do it...

Let's see the new updates:

  1. Components can now return arrays and strings from render: Before, React forced you to return an element wrapped with a <div> or any other tag; now it is possible to return an array or string directly:
    // Example 1: Returning an array of elements.
render() {
// Now you don't need to wrap list items in an extra element
return [
<li key="1">First item</li>,
<li key="2">Second item</li>,
<li key="3">Third item</li>,
];
}

// Example 2: Returning a string
render() {
return 'Hello World!';
}
  1. Also, React now has a new feature called Fragment, which also works as a special wrapper for elements. It can be specified with empty tags (<></>) or directly using React.Fragment:
    // Example 1: Using empty tags <></>
render() {
return (
<>
<ComponentA />
<ComponentB />
<ComponentC />
</>
);
}

// Example 2: Using React.Fragment
render() {
return (
<React.Fragment>
<h1>An h1 heading</h1>
Some text here.
<h2>An h2 heading</h2>
More text here.
Even more text here.
</React.Fragment>
);
}

// Example 3: Importing Fragment
import React, { Fragment } from 'react';
...
render() {
return (
<Fragment>
<h1>An h1 heading</h1>
Some text here.
<h2>An h2 heading</h2>
More text here.
Even more text here.
</Fragment>
);
}
  1. Error boundaries with from the official website:
A JavaScript error in a part of the UI shouldn’t break the whole app. To solve this problem for React users, React 16 introduces a new concept of an "error boundary". Error boundaries are React components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI instead of the component tree that crashed. Error boundaries catch errors during rendering, in lifecycle methods, and in constructors of the whole tree below them. A class component becomes an error boundary if it defines a new lifecycle method called componentDidCatch(error, info).
    class ErrorBoundary extends React.Component {
constructor(props) {
super(props);

this.state = {
hasError: false
};
}

componentDidCatch(error, info) {
// Display fallback UI
this.setState({
hasError: true
});

// You can also log the error to an error reporting service
logErrorToMyService(error, info);
}

render() {
if (this.state.hasError) {
// You can render any custom fallback UI
return <h1>Something went wrong.</h1>;
}

return this.props.children;
}
}

// Then you can use it as a regular component:
render() {
<ErrorBoundary>
<MyComponent />
</ErrorBoundary>
}
  1. Better server-side rendering with from the official site:
React 16 includes a completely rewritten server renderer. It's really fast. It supports streaming, so you can start sending bytes to the client faster. And thanks to a new packaging strategy that compiles away process.env checks (Believe it or not, reading process.env in Node is really slow!), you no longer need to bundle React to get good server-rendering performance.
  1. Reduced file size with from the official site: "Despite all these additions, React 16 is actually smaller compared to 15.6.1.
    • react is 5.3 kb (2.2 kb gzipped), down from 20.7 kb (6.9 kb gzipped)
    • react-dom is 103.7 kb (32.6 kb gzipped), down from 141 kb (42.9 kb gzipped)
    • react + react-dom is 109 kb (34.8 kb gzipped), down from 161.7 kb (49.8 kb gzipped)

That amounts to a combined 32% size decrease compared to the previous version (30% post-gzip)."


If you want to check the latest updates on React, you can visit the official React blog: https://reactjs.org/blog.

Using React on Windows

I'm not a big fan of Windows for development since it's kind of problematic to configure sometimes. I will always prefer Linux or Mac, but I'm aware that a lot of people who are reading this book will use Windows. In this recipe, I'll show you the most common problems you may have when you try to follow the recipes in this book using Windows.

How to do it...

We'll now see the most common problems using Windows for development:

  1. Terminal: The first problem you will face is to use the Windows terminal (CMD) because it does not support Unix commands (like Linux or Mac). The solution is to install a Unix Terminal; the most highly recommended is to use the Git Bash Terminal, which is included with Git when you install it (https://git-scm.com), and the second option is to install Cygwin, which is a Linux Terminal in Windows (https://www.cygwin.com).
  2. Environment variables: Another common problem using Windows is to set environment variables. Generally, when we write npm scripts, we set environment variables such as NODE_ENV=production or BABEL_ENV=development, but to set those variables in Windows, you use the SET command, which means you need to do SET NODE_ENV=production or SET BABEL_ENV=development. The problem with this is that if you are working with other people that use Linux or Mac, they will have problems with the SET command, and probably you will need to ignore this file and modify it only for your local environment. This can be tedious. The solution to this problem is to use a package called cross-env; you can install it by doing npm install cross-env, and this will work in Windows, Mac, and Linux:
   "scripts": {
"start": "cross-env NODE_ENV=development webpack-dev-server --
mode development --open",
"start-production": "cross-env NODE_ENV=production webpack-dev-
server --mode production"
}

  1. Case-sensitive files or directories: In reality, this also happens on Linux, but sometimes it is very difficult to identify this problem, for example, if you create a component in the components/home/Home.jsx directory but in your code you're trying to import the component like this:
    import Home from './components/Home/Home';
Normally, this won't cause any problems on Mac but can generate an error on Linux or Windows because we are trying to import a file with a different name (because it's case-sensitive) into the directory.
  1. Paths: Windows uses a backslash (\) to define a path, while in Mac or Linux they use a forward slash (/). This is problematic because sometimes we need to define a path (in Node.js mostly) and we need to do something like this:
    // In Mac or Linux
app.use(
stylus.middleware({
src: __dirname + '/stylus',
dest: __dirname + '/public/css',
compile: (str, path) => {
return stylus(str)
.set('filename', path)
.set('compress', true);
}
})
);

// In Windows
app.use(
stylus.middleware({
src: __dirname + '\stylus',
dest: __dirname + '\public\css',
compile: (str, path) => {
return stylus(str)
.set('filename', path)
.set('compress', true);
}
})
);

// This can be fixed by using path
import path from 'path';

// path.join will generate a valid path for Windows or Linux and Mac
app.use(
stylus.middleware({
src: path.join(__dirname, 'stylus'),
dest: path.join(__dirname, 'public', 'css'),
compile: (str, path) => {
return stylus(str)
.set('filename', path)
.set('compress', config().html.css.compress);
}
})
);
Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Use essential hacks and simple techniques to solve React application development challenges
  • Create native mobile applications for iOS and Android using React Native
  • Learn how you can write robust tests for your applications using Jest and Enzyme

Description

React.js is Facebook's dynamic frontend web development framework. It helps you build efficient, high-performing web applications with an intuitive user interface. With more than 66 practical and self-contained tutorials, this book examines common pain points and best practices for building web applications with React. Each recipe addresses a specific problem and offers a proven solution with insights into how it works, so that you can modify the code and configuration files to suit your requirements. The React Cookbook starts with recipes for installing and setting up the React.js environment with the Create React Apps tool. You’ll understand how to build web components, forms, animations, and handle events. You’ll then delve into Redux for state management and build amazing UI designs. With the help of practical solutions, this book will guide you in testing, debugging, and scaling your web applications, and get to grips with web technologies like WebPack, Node, and Firebase to develop web APIs and implement SSR capabilities in your apps. Before you wrap up, the recipes on React Native and React VR will assist you in exploring mobile development with React. By the end of the book, you will have become familiar with all the essential tools and best practices required to build efficient solutions on the web with React.

Who is this book for?

If you’re a JavaScript developer who wants to build efficient and scalable solutions, this book is for you. Although not necessary, some knowledge of React will be an advantage. Also, if you have experience working with React, this book will help you improve your skills.

What you will learn

  • Understand complex topics such as Webpack and server-side rendering
  • Implement an API using Node.js, Firebase, and GraphQL
  • Maximize the performance of your React applications
  • Create a mobile application using React Native
  • Deploy a React application on Digital Ocean
  • Get to know best practices when organizing and testing a large React application
Estimated delivery fee Deliver to Hungary

Premium delivery 7 - 10 business days

€25.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 30, 2018
Length: 580 pages
Edition : 1st
Language : English
ISBN-13 : 9781783980727
Vendor :
Facebook
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Hungary

Premium delivery 7 - 10 business days

€25.95
(Includes tracking information)

Product Details

Publication date : Aug 30, 2018
Length: 580 pages
Edition : 1st
Language : English
ISBN-13 : 9781783980727
Vendor :
Facebook
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 110.97
React Cookbook
€36.99
ReactJS by Example - Building Modern Web Applications with React
€36.99
Full-Stack React Projects
€36.99
Total 110.97 Stars icon
Banner background image

Table of Contents

16 Chapters
Working with React Chevron down icon Chevron up icon
Conquering Components and JSX Chevron down icon Chevron up icon
Handling Events, Binding and Useful React Packages Chevron down icon Chevron up icon
Adding Routes to Our Application with React Router Chevron down icon Chevron up icon
Mastering Redux Chevron down icon Chevron up icon
Creating Forms with Redux Form Chevron down icon Chevron up icon
Animations with React Chevron down icon Chevron up icon
Creating an API with Node.js Using MongoDB and MySQL Chevron down icon Chevron up icon
Apollo and GraphQL Chevron down icon Chevron up icon
Mastering Webpack 4.x Chevron down icon Chevron up icon
Implementing Server-Side Rendering Chevron down icon Chevron up icon
Testing and Debugging Chevron down icon Chevron up icon
Deploying to Production Chevron down icon Chevron up icon
Working with React Native Chevron down icon Chevron up icon
Most Common React Interview Questions Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.5
(6 Ratings)
5 star 16.7%
4 star 16.7%
3 star 0%
2 star 33.3%
1 star 33.3%
Filter icon Filter
Top Reviews

Filter reviews by




Maxx Traxx Sep 18, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Being new to React I really needed something that was beyond the ole "Hello World" or "To Do" app tutorials and this book is great for that! Easy to follow with real world examples, I enjoyed that and the author's casual style; excellent code samples and a good approach for solving real problems. Recommended!
Amazon Verified review Amazon
Peter Pham Nov 14, 2018
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Overall, I believe the book is good, but there are certain things that are not explained in detailed that should be. It could be confusing to some people that are complete beginners to web development. One instance would be, that some of the CSS is using SASS notation and won't work properly.The code examples are great and are easy to follow. If you take the time to understand the underlying code, it is a great foundation to build off of.I would recommend this book to people learning React.
Amazon Verified review Amazon
Nick May 20, 2019
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
This book has a good source of information but it is poorly written for a beginner and full of typos. Much of the code is written without any explanation. Fortunately I was able to Google much of what was being introduced. None of the firebase commands are explained but I found them from reading the docs. The author just expects you to be familiar with firebase. The Redux chapter starts off with a good introduction but fails to explain the code as it continues rattling off commands without any explanation. My coding background helped me to understand many other unexplained concepts but I can't imagine if I didn't have any coding experience how lost I would be.CONCLUSION:The good: it shows how to use fullstack react using mongo, graphql, redux, node, Express, and several other methods to build the frontend and backend of web apps. It provides a good path on how to move forward in your journey on react.The Bad: Most of the book contains unexplained code and assumes that you understand the new concepts being introduced without any explanation such as the use of axios without defining the arguments and firebase commands and redux section. This book introduces great concepts such as how to integrate mongodb, using apollo, etc. But requires the reader to pick up many other books or read documentation or blogs to understand the specifics. I would recommend fullstack react over this book as it offers better explanations such as the two ways setState method works in accepting an object or a arguments of current state and a callback function.
Amazon Verified review Amazon
Lynn and Scott May 29, 2019
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
I am a raw React beginner. This book starts off OK. But, after that the code is not explained well and (for me) several instructions are not working. I had high hopes for this book because of all the topics related to React it covered. If you are a beginner try another book.
Amazon Verified review Amazon
martin pszczola May 19, 2019
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
If you are going to shell out the high price of texts like this, get the paper version. The Kindle version formatting is terrible.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela