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

Actions


Actions are typically the data that enters into an application, either directly from the View or from an external Web API. Each action is nothing but a JavaScript method, which contains two parts: the actionType and the actual data. The actionCreators methods are simply discrete, semantic helper functions that facilitate passing data to the dispatcher in the form of an action. The different types of actions are declared as a JavaScript object, in a file named App-Constants.js. According to the Flux app hierarchy, the App-Contstants.js file resides under src/js/constants. Typical example for such a file looks like the following:

module.exports = {
        ADD_BOOK: 'ADD_BOOK',
        DELETE_BOOK: 'DELETE_BOOK',
        INC_BOOK_COUNT: 'INC_BOOK_COUNT',
        
DEC_BOOK_COUNT: 'DEC_BOOK_COUNT'
}

Here, ADD_BOOK, DELETE_BOOK are the actions.

Note

Actions, by itself, do not contain any functionality of their own. Actions are typically executed by the stores and are available in order to...

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}