Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Getting Started with React

You're reading from  Getting Started with React

Product type Book
Published in Apr 2016
Publisher
ISBN-13 9781783550579
Pages 212 pages
Edition 1st Edition
Languages
Authors (3):
Doel Sengupta Doel Sengupta
Profile icon Doel Sengupta
Manu Singhal Manu Singhal
Profile icon Manu Singhal
Danillo Corvalan Danillo Corvalan
Profile icon Danillo Corvalan
View More author details

Table of Contents (18) Chapters

Understanding Mixins


The Mixins (reusable components) are typically those React components that are used in multiple places and thus can be reused. Typically, the design elements, such as buttons, layout components, form fields, or any code logic/computation, that are used more than once are extracted in code named Mixin. Thus, Mixins help us incorporate some additional functionalities to existing React components by acting as helpers.

Note

Like in the previous chapters , the index.html content remains the same. Only the contents of the corresponding js (having the React components) changes.

Exploring Mixins by example

In this example we are setting the interval of the window global objects for every 100 ms:

Content of index.html:

<!DOCTYPE html>
            <html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.0-rc1/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/JSXTransformer.js"></script...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}