0% found this document useful (0 votes)
8 views

43219

The Complete Redux Book by Ilya Gelman and Boris Dinkevich is a comprehensive guide for building real projects with Redux, published on January 30, 2017. The book covers core concepts, practical applications, and real-world usage of Redux, making it suitable for both beginners and experienced developers. It is available for purchase on Leanpub and includes a code repository for reference.

Uploaded by

walkatheocx0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

43219

The Complete Redux Book by Ilya Gelman and Boris Dinkevich is a comprehensive guide for building real projects with Redux, published on January 30, 2017. The book covers core concepts, practical applications, and real-world usage of Redux, making it suitable for both beginners and experienced developers. It is available for purchase on Leanpub and includes a code repository for reference.

Uploaded by

walkatheocx0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 64

The Complete Redux Book Boris Dinkevich pdf

download

https://textbookfull.com/product/the-complete-redux-book-boris-
dinkevich/

Download more ebook from https://textbookfull.com


We believe these products will be a great fit for you. Click
the link to download now, or visit textbookfull.com
to discover even more!

The Complete Book of Triathlon Kleanthous

https://textbookfull.com/product/the-complete-book-of-triathlon-
kleanthous/

The Complete Recovery Room Book Anne Craig

https://textbookfull.com/product/the-complete-recovery-room-book-
anne-craig/

ng book The Complete Book on AngularJS 1st Edition Ari


Lerner

https://textbookfull.com/product/ng-book-the-complete-book-on-
angularjs-1st-edition-ari-lerner/

Ang-book 2: The Complete Book on Angular 2 1st Edition


Nate Murray

https://textbookfull.com/product/ang-book-2-the-complete-book-on-
angular-2-1st-edition-nate-murray/
ng-book The Complete Guide to Angular Nate Murray

https://textbookfull.com/product/ng-book-the-complete-guide-to-
angular-nate-murray/

Euclid s Elements Redux John Casey

https://textbookfull.com/product/euclid-s-elements-redux-john-
casey/

ng-book: The Complete Guide to Angular 5 Nathan Murray

https://textbookfull.com/product/ng-book-the-complete-guide-to-
angular-5-nathan-murray/

Ng Book The Complete Guide to Angular 9 Nathan Murray

https://textbookfull.com/product/ng-book-the-complete-guide-to-
angular-9-nathan-murray/

The Complete Google Guide Book 1st Edition Black Dog


Media

https://textbookfull.com/product/the-complete-google-guide-
book-1st-edition-black-dog-media/
The Complete Redux Book
Everything you need to build real projects with Redux

Ilya Gelman and Boris Dinkevich


This book is for sale at http://leanpub.com/redux-book

This version was published on 2017-01-30

This is a Leanpub book. Leanpub empowers authors and publishers with the Lean Publishing
process. Lean Publishing is the act of publishing an in-progress ebook using lightweight tools and
many iterations to get reader feedback, pivot until you have the right book and build traction once
you do.

© 2015 - 2017 Ilya Gelman and Boris Dinkevich


Tweet This Book!
Please help Ilya Gelman and Boris Dinkevich by spreading the word about this book on Twitter!
The suggested tweet for this book is:
Time to learn Redux!
The suggested hashtag for this book is #ReduxBook.
Find out what other people are saying about the book by clicking on this link to search for this
hashtag on Twitter:
https://twitter.com/search?q=#ReduxBook
Contents

Should I Read This Book? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

How to Read This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Code Repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Part 1. Introduction to Redux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Chapter 1. Core Concepts of Flux and Redux . . . . . . . . . . . . . . . . . . . . . . . . . 6


What Is Flux? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Redux and Flux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Redux Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
General Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Redux and React . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Basic Redux Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

Chapter 2. Your First Redux Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23


Starter Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Our First Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Setting Up the Store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Adding Recipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Adding Ingredients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Structuring the Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
A Closer Look at Reducers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Handling Typos and Duplicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Simple UI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Getting Data from the Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

Part 2. Real World Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

Chapter 3. State Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42


CONTENTS

The Concept of Separation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42


State as a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Keeping a Normalized State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Persisting State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Real-World State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

Chapter 4. Server Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54


Using Promises in Action Creators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
API Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Moving Code from Action Creators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Using the API Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Loading Indicator (Spinner) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Dynamic Action Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
More Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Chaining APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Canceling API Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

Chapter 5. WebSockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Basic Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Redux Link . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Code Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Complete WebSocket Middleware Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

Chapter 6. Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Test Files and Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Testing Action Creators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Async Action Creators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Reducer Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Testing Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Integration Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

Part 3. Advanced Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

Chapter 7. The Store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111


Creating a Store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Decorating the Store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
CONTENTS

Chapter 8. Actions and Action Creators . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124


Passing Parameters to Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Action Creators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Flux Standard Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
String Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Testing Action Creators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
redux-thunk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
redux-actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

Chapter 9. Reducers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143


Reducers in Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Avoiding Mutations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Ensuring Immutability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Higher-Order Reducers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Testing Reducers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

Chapter 10. Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159


Understanding next() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Our First Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Async Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Using Middleware for Flow Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Other Action Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Difference Between next() and dispatch() . . . . . . . . . . . . . . . . . . . . . . . . . 168
Parameter-Based Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
How Are Middleware Used? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172


Resource Repositories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Useful Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Courses and Tutorials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Should I Read This Book?
There are many tutorials and blog posts about Redux on the Internet. The library also has great
official documentation. This book isn’t supposed to be either a tutorial or documentation. The goal
is to provide a methodical explanation of Redux core concepts and how those can be extended and
used in large and complex Redux applications.
As a frontend consultancy, we help dozens of companies build great projects using Redux. Many
projects face the same problems and ask the same questions. How should we structure the
application? What is the best way to implement server communication? What is the best solution
for form validation? Where should we handle side effects? How will Redux benefit our applications?
This book is intended to serve as a companion for developers using Redux on a daily basis. It aims to
give answers to many of the above questions and provide solutions to the most common problems
in real-world applications. It can be used to learn Redux from the ground up, to better understand
the structure of a large application, and as a reference during development.
The book is structured in a way that doesn’t force the reader to read it start to finish but rather
allows you to skip parts and come back to them when you face the problem at hand or have free
time to deepen your knowledge. We love Redux, and we have tried to share our excitement about it
in this book. We hope that you will find it useful.
How to Read This Book
While Redux in itself is a small library, the underlying concepts and the ecosystem around it are
large and complex. In this book we cover the core and common concepts and methods a developer
needs to work with Redux on both small and large-scale applications.
The book is separated into three parts. In the first part you will learn the basics of Redux. Chapter
1 covers the core concepts behind Redux, introducing the different “actors” and how it is built. In
Chapter 2, we build an example project step by step; here, you will learn how to use Redux in a
project.
The second part of the book is about examples and use cases from real applications. Redux has
a great ecosystem, and there are a lot of tips, tricks, and libraries that can be applied to many
projects of different scale. We provide you with solutions for common problems including server
communications, authorization, internationalization, routing, forms, wizards, and more.
The third part is a deep dive into Redux usage. It is separated into chapters by Redux entity types:
actions, middleware, reducers, and the store and store enhancers. The chapters in this section include
advanced explanations of Redux internals and how to properly use them in complex scenarios, and
they are a must-read for anyone considering building large applications with Redux.
It is highly recommended that you start by reading the first part as a whole. Even if you already have
knowledge of Redux and have used it, the opening chapters will clarify all the underlying concepts
and lay down the groundwork for the code we will use throughout the second and third parts of the
book.
No matter who you are—an explorer learning about Redux for fun, or a hard-working professional
who needs to solve real problems fast—this book will provide new ideas and insights to help you on
your path.
Acknowledgements
Writing a technical book on a popular JavaScript library nowadays isn’t a simple task. New
techniques, best practices and opinions keep popping up every other week. Combined with daily
job and a family makes it even harder. The only way we could succeed is with a help from other
awesome people along the way.
To Redux creators, Dan Abramov and Andrew Clark, as well as to many contributors to Redux and
its ecosystem, thank you for improving data management and making this book relevant.
To our technical copyeditor, Rachel Head¹, thank you so much for fixing our English and making
this book more understandable.
To all our colleagues at 500Tech², thanks for being awesome and making us feel good everyday.
And obviously thank you, our dear reader, for deciding to spend your time and money on reading
this book. We hope you enjoy reading it as much as we did writing it.
Boris & Ilya
¹https://fr.linkedin.com/in/rachel-head-a45258a2
²http://500tech.com
Code Repository
The code samples from this book are available in the book repository on Github and should work
in all modern browsers.
https://github.com/redux-book
Part 1. Introduction to Redux
Chapter 1. Core Concepts of Flux and
Redux
Penicillin, x-rays, and the pacemaker are famous examples of unintended discoveries³. Redux, in a
similar way, wasn’t meant to become a library, but turned out to be a great Flux implementation.
In May 2015, one of its authors, Dan Abramov⁴, submitted a talk to the ReactEurope conference
about “hot reloading and time travel.” He admits he had no idea how to implement time travel at
that point. With some help from Andrew Clark⁵ and inspired by some elegant ideas from the Elm⁶
language, Dan eventually came up with a very nice architecture. When people started catching on
to it, he decided to market it as a library.
In less than half a year, that small (only 2 KB) library became the go-to framework for React
developers, as its tiny size, easy-to-read code, and very simple yet neat ideas were much easier to
get to grips with than competing Flux implementations. In fact, Redux is not exactly a Flux library,
though it evolved from the ideas behind Facebook’s Flux architecture. The official definition of
Redux⁷ is a predictable state container for JavaScript applications. This simply means that you store
all of your application state in one place and can know what the state is at any given point in time.

What Is Flux?
Before diving into Redux, we should get familiar with its base and predecessor, the Flux architecture.
“Flux” is a generic architecture or pattern, rather than a specific implementation. Its ideas were
first introduced publicly by Bill Fisher and Jing Chen at the Facebook F8 conference in April 2014.
Flux was touted as redefining the previous ideas of MVC (Model–View–Controller) and MVVM
(Model–View–ViewModel) patterns and two-way data binding introduced by other frameworks by
suggesting a new flow of events on the frontend, called the unidirectional data flow.
In Flux events are managed one at a time in a circular flow with a number of actors: dispatcher,
stores, and actions. An action is a structure describing any change in the system: mouse clicks,
timeout events, Ajax requests, and so on. Actions are sent to a dispatcher, a single point in the
system where anyone can submit an action for handling. The application state is then maintained
in stores that hold parts of the application state and react to commands from the dispatcher.

³http://www.businessinsider.com/these-10-inventions-were-made-by-mistake-2010-11?op=1&IR=T
⁴http://survivejs.com/blog/redux-interview/
⁵https://twitter.com/acdlite
⁶http://elm-lang.org
⁷http://redux.js.org/
Chapter 1. Core Concepts of Flux and Redux 7

Here is the simplest Flux flow:

1. Stores subscribe to a subset of actions.


2. An action is sent to the dispatcher.
3. The dispatcher notifies subscribed stores of the action.
4. Stores update their state based on the action.
5. The view updates according to the new state in the stores.
6. The next action can then be processed.

Flux overview

This flow ensures that it’s easy to reason about how actions flow in the system, what will cause the
state to change, and how it will change.
Consider an example from a jQuery or AngularJS application. A click on a button can cause multiple
callbacks to be executed, each updating different parts of the system, which might in turn trigger
updates in other places. In this scenario it is virtually impossible for the developer of a large
application to know how a single event might modify the application’s state, and in what order
the changes will occur.
In Flux, the click event will generate a single action that will mutate the store and then the view. Any
actions created by the store or other components during this process will be queued and executed
only after the first action is done and the view is updated.
Facebook’s developers did not initially open-source their implementation of Flux, but rather released
only parts of it, like the dispatcher. This caused a lot of open-source implementations to be built by
the community, some of them significantly different and some only slightly changing the original
Chapter 1. Core Concepts of Flux and Redux 8

patterns. For example, some moved to having multiple dispatchers or introduced dependencies
between stores.

Dmitri Voronianski has a good comparison of various Flux implementations on GitHub⁸.

Redux and Flux


While Redux derives from Flux concepts, there are a few distinctions between the two architectures.
In contrast to Flux, Redux only has a single store that holds no logic by itself. Actions are dispatched
and handled directly by the store, eliminating the need for a standalone dispatcher. In turn, the store
passes the actions to state-changing functions called reducers, a new type of actor added by Redux.

Dispatcher out, reducers in

To better understand Redux, let’s imagine an application that helps us manage a recipe book. The
Redux store is where the recipe book itself will be saved, in a structure that might be a list of recipes
and their details.
The app will allow us to perform different actions like adding a recipe, adding ingredients to a
recipe, changing the quantity of an ingredient, and more. To make our code generic, we can create a
number of services. Each service will know how to handle a group of actions. For example, the book
service will handle all the add/remove recipe actions, the recipe service will handle changing recipe
information, and the recipe-ingredients service will handle the actions to do with ingredients. This
will allow us to better divide our code and in the future easily add support for more actions.
To make it work, our store could call each of our services and pass them two parameters: the current
recipe book and the action we want to perform. Each service in turn will modify the book if the
action is one it knows how to handle. Why pass the action to all the services? Maybe some actions
⁸https://github.com/voronianski/flux-comparison
Chapter 1. Core Concepts of Flux and Redux 9

affect more than one service. For example, changing the measurements from grams to ounces will
cause the ingredients service to recalculate the amounts and the recipe service to mark the recipe as
using imperial measurements. In Redux, these services are the reducers.
We might want to add another layer, the middleware. Every action will be first passed through a list
of middleware. Unlike reducers, middleware can modify, stop, or add more actions. Examples might
include: a logging middleware, an authorization middleware that checks if the user has permissions
to run the action, or an API middleware that sends something to the server.
This simple example shows the base of Redux. We have a single store to control the state, actions to
describe the changes we want to make, reducers (services, in our example) that know how to mutate
the state based on the requested action, and middleware to handle the housekeeping tasks.
What makes Redux special, and sometimes hard to understand, is that reducers never change the
state (in our case, the recipe book), since it is immutable. Instead, the reducers must create a new
copy of the book, make the needed changes to the copy, and return the new, modified book to the
store. This approach allows Redux and the view layers to easily do change detection. In later chapters
we will discuss in detail why and how this approach is used.
It is important to note that the whole application state is kept in a single location, the store. Having a
single source of data provides enormous benefits during debugging, serialization, and development,
as will become apparent in the examples in this book.

Redux overview
Chapter 1. Core Concepts of Flux and Redux 10

Redux Terminology

Actions and Action Creators


The only way for an application to change the state is by processing actions. In most cases, actions in
Redux are nothing more than plain JavaScript objects passed to the store that hold all the information
needed for the store to be able to modify the state:

Example of an action object

1 {
2 type: 'INCREMENT',
3 payload: {
4 counterId: 'main',
5 amount: -10
6 }
7 }

Since these objects might have some logic and be used in multiple places in an application, they are
commonly wrapped in a function that can generate the objects based on a parameter:

A function that creates an action object

1 function incrementAction(counterId, amount) {


2 return {
3 type: 'INCREMENT',
4 payload: {
5 counterId,
6 amount
7 }
8 };
9 };

As these functions create action objects, they are aptly named action creators.

Reducers
Once an action is sent to the store, the store needs to figure out how to change the state accordingly.
To do so, it calls a function, passing it the current state and the received action:
Chapter 1. Core Concepts of Flux and Redux 11

A function that calculates the next state


1 function calculateNextState(currentState, action) {
2 ...
3 return nextState;
4 }

This function is called a reducer. In real Redux applications, there will be one root reducer function
that will call additional reducer functions to calculate the nested state.

A simple reducer implementation


1 function rootReducer(state, action) {
2 switch (action.type) {
3
4 case 'INCREMENT':
5 return { ...state, counter: state.counter + action.payload.amount };
6
7 default:
8 return state;
9 }
10 }

Reducers never modify the state; they always create a new copy with the needed modifi-
cations.

Middleware
Middleware is a more advanced feature of Redux and will be discussed in detail in later chapters.
The middleware act like interceptors for actions before they reach the store: they can modify the
actions, create more actions, suppress actions, and much more. Since the middleware have access to
the actions, the dispatch() function, and the store, they are the most versatile and powerful entities
in Redux.

Store
Unlike many other Flux implementations, Redux has a single store that holds the application
information but no user logic. The role of the store is to receive actions, pass them through all
the registered middleware, and then use reducers to calculate a new state and save it.
When it receives an action that causes a change to the state, the store will notify all the registered
listeners that a change to the state has been made. This will allow various parts of the system, like
the UI, to update themselves according to the new state.
Chapter 1. Core Concepts of Flux and Redux 12

General Concepts
Redux is about functional programming and pure functions. Understanding these concepts is crucial
to understanding the underlying principles of Redux.
Functional programming has become a trendy topic in the web development domain lately, but it
was invented around the 1950s. The paradigm centers around avoiding changing state and mutable
data—in other words, making your code predictable and free of side effects.
JavaScript allows you to write code in a functional style, as it treats functions as first-class objects.
This means you can store functions in variables, pass them as arguments to other functions, and
return them as values of other functions. But since JavaScript was not designed to be a functional
programming language per se, there are some caveats that you will need to keep in mind. In order
to get started with Redux, you need to understand pure functions and mutation.

Pure and Impure Functions


A pure function returns values by using only its arguments: it uses no additional data and changes
no data structures, touches no storage, and emits no external events (like network calls). This means
that you can be completely sure that every time you call the function with the same arguments, you
will always get the same result. Here are some examples of pure functions:

An example of a pure function

1 function square(x) {
2 return x * x;
3 }
4
5 Math.sin(y);
6
7 arr.map((item) => item.id);

If a function uses any variables not passed in as arguments or creates side effects, the function is
impure. When a function depends on variables or functions outside of its lexical scope, you can never
be sure that the function will behave the same every time it’s called. For example, the following are
impure functions:
Chapter 1. Core Concepts of Flux and Redux 13

An example of an impure function

1 function getUser(userId) {
2 return UsersModel.fetch(userId).then((result) => result);
3 }
4
5 Math.random();
6
7 arr.map((item) => calculate(item));

Mutating Objects
Another important concept that often causes headaches for developers starting to work with Redux
is immutability. JavaScript has limited tooling for managing immutable objects, and we are often
required to use external libraries.
Immutability means that something can’t be changed, guaranteeing developers that if you create an
object, it will have the same properties and values forever. For example, let’s declare a simple object
as a constant:

Object defined as constant in JavaScript

1 const colors = {
2 red: '#FF0000',
3 green: '#00FF00',
4 blue: '#0000FF'
5 };

Even though the colors object is a constant, we can still change its content, as const will only check
if the reference to the object is changed:

JavaScript allows changes of const defined objects

1 colors = {};
2 console.log(colors);
3
4 colors.red = '#FFFFFF';
5 console.log(colors.red);

Try writing this in the developer console. You will see that you can’t reassign an empty object to
colors, but you can change its internal value.

To make the colors object appear immutable, we can use the Object.freeze() method:
Chapter 1. Core Concepts of Flux and Redux 14

Making a plain object immutable


1 Object.freeze(colors);
2
3 colors.red = '#000000';
4
5 console.log(colors.red);

The value of the red property will now be '#FFFFFF'. If you thought that the value should be
'#FF0000', you missed that we changed the red property before we froze the object. This is a good
example of how easy it is to miss this kind of thing in real applications.
Here, once we used Object.freeze(), the colors object became immutable. In practice things
are often more complicated, though. JavaScript does not provide good native ways to make data
structures fully immutable. For example, Object.freeze() won’t freeze nested objects:

Object.freeze() does not freeze nested objects


1 const orders = {
2 bread: {
3 price: 10
4 },
5 milk: {
6 price: 20
7 }
8 };
9
10 Object.freeze(orders);
11
12 orders.milk.price -= 15;
13
14 console.log(orders.milk.price);

To work around the nature of our beloved language, we have to use third-party libraries like deep-
freeze⁹ or ImmutableJS¹⁰. We will talk about different immutable libraries later in the book.

Redux and React


Redux started out as a companion to React, but has started to gather a major following with other
frameworks like Angular. At its base Redux is fully framework-agnostic, and it can easily be used
with any JavaScript framework to handle state and changes.
⁹https://github.com/substack/deep-freeze
¹⁰https://facebook.github.io/immutable-js/
Chapter 1. Core Concepts of Flux and Redux 15

The connection to different frameworks is done with the help of third-party libraries that provide
a set of convenience functions for each framework in order to seamlessly connect to Redux. The
library that we will use to connect Redux and React is called react-redux, and we will be covering
it extensively later in the book.

Basic Redux Implementation


People love Redux because of its simplicity. In fact, it is so simple that we can implement most of it
in a handful of lines of code. Thus, unlike with other frameworks, where the only way to learn is to
study the API, here we can start by implementing Redux ourselves.
The basic premise behind Redux is the idea that all the application state is saved in one place, the
store. To use this idea in applications we will need to find a way to:

1. Modify the state as a result of events (user-generated or from the server).


2. Monitor state changes so we can update the UI.

The first part can be split into two blocks of functionality:

1. Notify the store that an action has happened.


2. Help the store figure out how to modify the state according to our application’s logic.

Using this structure, let’s build a simple application that will implement a counter. Our application
will use pure JavaScript and HTML and require no additional libraries. We are going to have two
buttons that allow us to increment and decrement a simple counter, and a place where we can see
the current counter value:

The index.html file

1 <div>
2 Counter:
3 <span id='counter'></span>
4 </div>
5
6 <button id='inc'>Increment</button>
7 <button id='dec'>Decrement</button>

Our application state will simply hold the counter value:


Chapter 1. Core Concepts of Flux and Redux 16

A simple state holding a counter

1 let state = {
2 counter: 3
3 };

To make our demo functional, let’s create a click handler for each button that will use a dispatch()
function to notify our store that an action needs to be performed:

A basic dispatch API

1 function dispatch(action) { ... };

Connect click events to dispatch

1 // Listen to click events


2 document.querySelector('#inc').onclick = () => dispatch('INC');
3 document.querySelector('#dec').onclick = () => dispatch('DEC');

We will come back to its implementation later in this chapter. Also, let’s define a function that will
update the counter’s value in the HTML based on application state received as an argument:

Code to update the counter in the DOM

1 // Update view (this might be React or Angular2 in a real app)


2 function updateView() {
3 document.querySelector('#counter').innerText = state.counter;
4 }

Since we want our view to represent the current application state, we need it to be updated every
time the state (and the counter) changes. For that, we will use the subscribe() function, which
we will also implement a bit later. The role of the function will be to call our callback every time
anything in the state changes:

Subscribe to changes API

1 subscribe(updateView);

We have now created a basic application structure with a simple state, implemented a function that
will be responsible for updating the HTML based on the state, and defined two “magic” functions—
dispatch() and subscribe()—to dispatch actions and subscribe to changes in state. But there is
Chapter 1. Core Concepts of Flux and Redux 17

still one thing missing. How will our mini-Redux know how to handle the events and change the
application state?
For this, we define an additional function. On each action dispatched, Redux will call our function,
passing it the current state and the action. To be compliant with Redux’s terminology, we will call
the function a reducer. The job of the reducer will be to understand the action and, based on it, create
a new state.
In our simple example our state will hold a counter, and its value will be incremented or decremented
based on the action:

Simple reducer for INC and DEC actions

1 // Our mutation (reducer) function creates a new state based on the action passed
2 function reducer(state, action) {
3 switch (action) {
4 case 'INC':
5 return { ...state, counter: state.counter + 1 };
6 case 'DEC':
7 return { ...state, counter: state.counter - 1 };
8 default:
9 return state;
10 }
11 }

An important thing to remember is that reducers must always return a new, modified copy of the
state. They shouldn’t mutate the existing state, like in this example:

Incorrect way to change state

1 // This is wrong!
2 state.counter = state.counter + 1;

Later in the book you will learn how you can avoid mutations in JavaScript with and without the
help of external libraries.
Now it’s time to implement the actual change of the state. Since we are building a generic framework,
we will not include the code to increment/decrement the counter (as it is application-specific) but
rather will call a function that we expect the user to supply, called reducer(). This is the reducer
we mentioned before.
The dispatch() function calls the reducer() implemented by the application creator, passing it both
the current state and the action it received. This information should be enough for the reducer()
function to calculate a new state. We then check if the new state differs from the old one, and if it
does, we replace the old state and notify all the listeners of the change:
Chapter 1. Core Concepts of Flux and Redux 18

Implementation of the disptach API

1 let state = null;


2
3 function dispatch(action) {
4 const newState = reducer(state, action);
5
6 if (newState !== state) {
7 state = newState;
8
9 listeners.forEach(listener => listener());
10 }
11 }

Again, it is very important to note that we expect a reducer to create a new state and not just modify
the existing one. We will be using a simple comparison by reference to check whether the state has
changed.
One remaining task is to notify our view of the state change. In our example we only have a single
listener, but we already can implement full listener support by allowing multiple callbacks to register
for the “state change” event. We will implement this by keeping a list of all the registered callbacks:

Implementation of the subscribe API

1 const listeners = [];


2
3 function subscribe(callback) {
4 listeners.push(callback);
5 }

This might surprise you, but we have just implemented the major part of the Redux framework. The
real code¹¹ isn’t much longer, and we highly recommended that you take half an hour to read it.

Using the Real Redux


To complete our example, let’s switch to the real Redux library and see how similar the solution
remains. First we’ll add the Redux library, for now using CDNJS:

¹¹https://github.com/reactjs/redux/tree/master/src
Chapter 1. Core Concepts of Flux and Redux 19

Adding Redux to a project

1 <script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.6.0/redux.min.js" />

We will change our previous state definition to be a constant that only defines the initial value of
the state:

The initial state

1 const initialState = {
2 counter: 3
3 };

Now we can use it to create a Redux store:

Creating a Redux store

1 const store = Redux.createStore(reducer, initialState);

As you can see, we are using our reducer from before. The only change that needs to be made to the
reducer is the switch statement. Instead of doing:

Previous reducer code

1 switch (action)

Changes to

New reducer code

1 switch (action.type)

The reason behind this is that actions in Redux are objects that have the special type property, which
makes reducer creation and action data more consistent.
The Redux store will also give us all the features we implemented ourselves before, like subscribe()
and dispatch(). Thus, we can safely delete these methods.
To subscribe to store changes, we will simply call the subscribe() method of the store:
Chapter 1. Core Concepts of Flux and Redux 20

Subscribing to store updates

1 store.subscribe(updateView);

Since subscribe() does not pass the state to the callback, we will need to access it via store.getState():

Update view by getting the state out of the store

1 // Update view (this might be React in a real app)


2 function updateView() {
3 document.querySelector('#counter').innerText = store.getState().counter;
4 }
5
6 store.subscribe(updateView);

The last change is in the dispatch() method. As mentioned previously, our actions now need to
have the type property. Thus, instead of simply sending the string 'INC' as the action, we now need
to send { type: 'INC' }.
Chapter 1. Core Concepts of Flux and Redux 21

The Complete Example

The HTML

1 <script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.6.0/redux.min.js" />


2
3 <div>
4 Counter:
5 <span id='counter'> </span>
6 </div>
7
8 <button id='inc'>Increment</button>
9 <button id='dec'>Decrement</button>

The JavaScript

1 // Our mutation (Reducer) function,


2 // create a _new_ state based on the action passed
3 function reducer(state, action) {
4 switch(action.type) {
5 case 'INC':
6 return { ...state, counter: state.counter + 1 };
7 case 'DEC':
8 return { ...state, counter: state.counter - 1 };
9 default:
10 return state;
11 }
12 }
13
14 const initialState = {
15 counter: 3
16 };
17
18 const store = Redux.createStore(reducer, initialState);
19
20 // Update view (this might be React in a real app)
21 function updateView() {
22 document.querySelector('#counter').innerText = store.getState().counter;
23 }
24
25 store.subscribe(updateView);
26
Chapter 1. Core Concepts of Flux and Redux 22

27 // Update view for the first time


28 updateView();
29
30 // Listen to click events
31 document.getElementById('inc').onclick = () => store.dispatch({ type: 'INC' });
32 document.getElementById('dec').onclick = () => store.dispatch({ type: 'DEC' });

Summary
In this chapter we briefly covered the history of Redux and Flux, and learned how Redux works at its
core. We also learned a bit about basic functional programming principles, such as pure functions
and immutability. As they are very important for our real-world applications, we will talk about
these concepts more later in the book. In the next chapter we are going to see how to actually work
with Redux by building a simple recipe book application.
Chapter 2. Your First Redux
Application
In the previous chapter we learned what Redux is and how it works. In this chapter we will learn
how to use it for a simple project. The code base created in this chapter will be used as the base for
all the examples in the rest of this book. It is highly recommended that you follow along with and
fully understand this chapter and its code before moving on to more advanced topics.

Starter Project
Modern client-side applications often require a set of so-called boilerplate in order to make devel-
opment easier. The boilerplate may include things such as directory structure, code transformation
tools like SCSS and ES2016 compilers, testing infrastructure, and production pipeline tools for tasks
such as minification, compression, and concatenation.
To ease the chore of setting up a new project, the open-source community has created dozens of
different starter projects. The larger ones, like react-redux-starter-kit¹², consist of over a hundred
files. We will use a much simpler boilerplate, just enough to cover all the concepts explained in this
book.
As our project will be pure Redux, it will require no React or related libraries. We will use Webpack¹³
as our main tool to handle all code transformation and production flow tasks.

Skeleton Overview
To start things off, let’s clone the starter project, install the needed packages, and verify that our
environment is ready:

Setting up the starter project

1 git clone http://github.com/redux-book/starter


2 cd starter
3 npm install
4 npm start

¹²https://github.com/davezuko/react-redux-starter-kit
¹³https://webpack.js.org/
Other documents randomly have
different content
voltak. S ez nem elég a sárosiakkal szemben. A sárosi csak idegen
helyen úr, a nógrádi csak otthon úr. Horváthy puha volt és szerény,
Brunner úr csak mosolygott az ő dolgán.
– Óh, Istenem, mit tehetnék én ebben? A lányka feje magától is
beforr, de ha én megszakitom a barátságot Kürtössyékkel, azt aztán
senki se tudja többé összevarrni.
Horváthy tehát nem kapott elégtételt, hanem ellenkezőleg,
értesülvén panaszairól Kürtössyék, üldözni kezdték a szegény
családot. Ezer apró módja van ennek, kivált fürdőn, a hol az
embereknek nincsen dolguk.
Egy-egy szúró megjegyzés, egy fumigativ mosoly, egy maliciózus
tekintet, egy becsmérlő kézmozdulat a maga helyén, – ez mind vérig
hat, ez mind ölhet.
– Ah, mily nevetségesek! – jegyzi meg a kamarás úr.
– Miféle népek lehetnek? – tünődik más alkalommal a
kamarásné. – Bizonyosan fölvett név ez a Horváthy…
– Hm! – böffenti ki a kamarás úr, – a mi az asszony Horváthyját
illeti, talán nem is existált.
– És hogy öltözik ez az asszony, mint egy cocotte.
– A szegény lánykának ferdén van nőve az egyik válla, szegény
kis maskara!
– S ez a vén trottli úgy fest mellettük, mint egy nyugalomba
vonult uzsorás. Talán az is.
Igy disgustálták a villabelieket. S mondhatni, az egész villa
Kürtössyékkel tartott, mert hiába, az emberek az előkelőbbekhez
húzódnak szivesebben. Hisz ez által magok is előkelőbbeknek
látszanak.
A Horváthyak érezték ezeket a rosz szeleket. A legjobb emberek
is visszahúzódtak tőlük. Miért? Hát miért? Ejh, Istenem, a kamarásné
azt mondta egy izben, felbigyesztett ajkkal, mikor a Peregi
kisasszonyokat Horváthynéval látta beszélgetni:
– Ah, szegény Peregi kisasszonyok, de meg lehetnek szorúlva
barátnék dolgában!
Ebből aztán meg lehet érteni, hogy Horváthyékkal beszélgetni
nem chic. Ennek hire ment és mindenki kerülte Horváthyékat, mert
nem chic velök ismerősnek lenni. A Peregi kisasszonyok pedig még a
többinél is jobban kerülték, mert a nagyobbiknak, Idának, Kürtössy
József hadnagy udvarolt.
Én épen ezekben a napokban érkeztem a fürdőbe, mikor a
legélesebbek voltak az ellentétek és szegény rokonaimat
valóságosan boykottálták a Veronában. A hadnagy javában flirtelt
Peregi Idával, a kamarásné pedig arra izgatta Brunner urat, hogy jó
volna a villát megtisztitani a Horváthy-familiától, „tudja, ügyesen,
szép szerével, kedves Brunner.“
Mire Brunner úr a bajuszát pödörgette:
– No, majd meglátjuk, no majd meglátjuk, forgós teremtette!
Volt hát panasz, mikor megjöttem – mert Horváthyné okos
asszony lévén, érezte a mérgezett hegyű nyilakat, átlátott a szitán,
éles szemmel észrevette az intrikák apró szálait, de asszony volt,
dacos, a ki nem hagyja el a csatateret. Sirva panaszolta el a
helyzetét, hogy el van rontva egész nyara s hogy mindennek a kis
zsivány Ponci az oka.
Az Esztike feje még akkor is be volt kötve. Kivált őt sajnáltam
meg nagyon, látván, hogy reszketve búvik a fenyőbokrok közé,
mikor a Ponci félelmes alakja megjelenik a láthatáron.
– Legjobb lesz, édes húgom, – mondám Horváthyénak, ha
kihurcolkodunk innen.
Horváthyné a fejét rázta.
– Inkább meghalok, hogysem egy tapodtat mozduljak.
– Akkor hát nekik kell pusztolniok.
Szemeiben lázas öröm csillant meg.
– Oh Istenem – fohászkodott fel ájtatosan s valóban szépek
voltak ilyenkor a szemei, – ha ezt megérhetném, szivesen halnék
meg.
Mosolyogtam. Ilyenek az asszonyok.
– De – tette hozzá rögtön csüggedten, elszomorodva, – az
lehetetlen!
– Majd megpróbálom, – feleltem s megsimogatva az Esztike
orcácskáit, őt is megbiztattam. – Ne félj semmit, kicsikém,
megbüntetjük azt a rosz Poncit, a ki téged megütött.
– Soh’se törődj velük, jó öcsém, – csititott az öreg Horváthy, – az
okosabb enged.
– De a türelmesebb, ravaszabb győz.
– Ha kikezdesz vele, csak magadnak csinálsz kellemetlenséget.
Nagy svihák az, nem lehet azzal itt megbirkózni. Mindenki mellette
van.
– Nem is akarok én ő vele összetűzni.
– Akkor aztán épen nem tudom elképzelni, mit csinálhatnál.
– Hát a diplomatia mire való? Csak hagyja azt ram, bátyámuram.
Az öreg morgott valamit s hitetlenül rázta fejét.
Pedig nekem már a tervem is megvolt hozzá. Szilárdul épitettem
fel Pantalovics Györgyre, egy bácskai földesúrra, a kivel együtt
jöttem a vasúton és a ki szintén a Veronába szállt. A bácskai úr
megint új genre. A sárosi nemes csak otthon nem úr, a nógrádi
nemes csak otthon úr, a bácskai nemes pedig mindenütt úr. A zsiros
földje megneveli önérzetének szarvait olyan keményekre, hogy azok
sehol le nem törnek s a hány ezer hold, annyi agancs.
Pantalovics György idegességben és asztmában szenvedett. Azt
mondta nekem utközben: „Ha ülök, én vagyok Magyarország
legegészségesebb embere; ha tiz lépést teszek, elfogy a lélekzetem,
én vagyok a legbetegebb ember a világon.“
Igénytelen, jámbor külseje volt, mint egy marhakupecnek, de a
mellett a legdölyfösebb despota lakozott benne: szeszélyes,
erőszakos, ellenmondást nem türő.
Én ajánlottam neki még a vasuton a Verona-villát, minélfogva
velem jött, de az első benyomás, a mit Brunner urra tett, nem igen
lehetett kedvező, mert a szegényesebb szobák közül, a földszinten
nyitott ki neki egyet.
– Nézd meg Zsuzsa!
Zsuzsa egy tenyeres-talpas paraszt asszony volt, a kit mint
ápolónét hozott magával. Csattanó piros képű, vaskos, olyan
terebélyes alsótesttel, mintha egy szénaboglya indulna, igaz is, hogy
lehetett rajta vagy tizenöt szoknya.
– Ez nem nekünk való, – mondta Zsuzsa – nincs jobb szobájuk?
– Jobb szoba kell, – magyarázta németül Brunner úrnak.
– Jobb szoba, forgós teremtette, – kiáltá nevetve Brunner úr. –
Ott van az emeleten a Milán király egykori szalonja az erkélylyel, he-
he-he.
– Mutassa meg! – szólt közbe hidegen Pantalovics.
Brunner ajkain gúnyos mosoly játszadozott.
– Hát tessék felfáradni. Én nem bánom, megmutathatom, de
tizenöt forint naponta.
– Csinos lehet! – jegyzé meg Pantalovics egyszerüen.
– Hát kivánják megnézni?
– Persze.
Brunner úr nem minden csodálkozás nélkül vezetett fel minket az
emeletre s bizonyos ünnepélyes mozdulattal nyitá ki a történelmi
nevezetsségü szentélyt.
Pantalovics intett a parasztasszonynak:
– Nézd meg, Zsuzsa!
Ő maga unalmasnak találta volna csak egy pillantást is vetni rá.
Zsuzsa kijelentette, hogy a szoba jó s ha két ágyat tesznek is
bele, még mindig igen kényelmesen lehet benne mozogni.
– Alzo bleibt, – mondá ki a végzést Pantalovics György.
– Tizenöt forint naponta, – hangsulyozta Brunner úr még egyszer,
nehogy félreértés forogjon fönn.
– Annyi, annyi, – intett türelmetlenül Pantalovics, – hozassa fel a
málhákat.
Két roppant faláda képezte a málhákat. Brunner úr nem minden
aggodalom nélkül nézegette. Előkelő urak szép bőröndökkel állitanak
be s négy forintos szobákra is alkusznak. Miféle Isten teremtése
lehet ez a Pantalovics?
Elhatározta, hogy szemmel fogja tartani s midőn Pantalovics
félóra mulva orvost hivatott, Brunner úr megvárta az orvost a
lépcsőkön.
– Nos mit mond ön az új vendéghez?
A doktor arcán hideg verejték gyöngyözött.
– Ördöngős fickó; megjártam vele. Azt mondja, a mint
megvizsgáltam: „Ha kigyógyit ön, kap két darab ezrest; ha ki nem
gyógyit és hiába molesztál a patikaszerekkel, lelövöm önt, mint egy
kutyát. Válaszszon!“
– És ön mit választott?
– Hogy kigyógyitom.
– Tehát belement a veszedelembe.
– Eh, ostobaság; ha kigyógyitom, megkapom a két ezrest; ha ki
nem gyógyitom, meghal s következéskép le nem lőhet.
– No, ebben igaza lehet.
Az új lakó nem is jött le aznap vacsorálni a hôtelbe; fenn a
szobában falatoztak a Zsuzsával egy tarisznyából.
Hm, ez különös! Brunner urat nagyon felizgatta a szobalány
ujságolása. Ez a disztelen étkezés. Egy tarisznyából a szolgálóval!
Pfuj! Nem lehet ez úri ember.
E különös dolgokon töprengett Brunner úr még este az ágyában
is. Ha olyan gazdag, hogy két ezer forintot igér a doktornak s
tizenötöt fizet naponta a szobáért, hisz akkor a legjobb ételeket
hozathatná magának. Vagy öltözne-e oly hanyagul, ha valósággal
tömve lenne a tárcája? Brunner úr egész éjjel Pantalovics felől
álmodott, a ki szelindek kutya alakjában ugrándozik előtte és
valahányszor megrázza magát, vagy egyet mozdit a farkán, mindig
egy körmöci arany esik ki belőle.
E csodálatos kutya birtokában jóleső érzésben élt és gazdagodott
Brunner úr, midőn a felesége kegyetlen kézzel felébreszté.
– Hans, kelj föl, öltözz fel. A Nr. 16 megbolondult, irtóztató
patáliákat tesz és rögtön veled kiván beszélni.
Brunner úr összerezzent. Épen Pantalovics volt a Nro. 16.
– Megbolondult? Hogy érted azt, Friderika?
– Hát hogy tombol mérgében, pofozza a cselédeket s követeli,
hogy állitsanak téged eléje.
Brunner úr kedvetlenül kászmálódott fel s sietett a Pantalovics
szobájába.
– Micsoda szobát adott ön nekem? – mennydörgött rá
Pantalovics. – Egész éjjel nem tudtam itt aludni. A szomszéd
szobában szakadatlanul köhögött valaki.
– Igen, igen, a Nro 15-ben egy betegünk van, – dadogta Brunner
úr, – egy járásbiró.
– No, hát ez egyszerüen türhetetlen.
– De mit csináljak, Istenem? – sóhajtott Brunner úr, szemeit,
mint Kádár, égre fölemelve. Ide végre is tüdőbetegek járnak és…
– Hát tegye másüvé. Cserélje el, vagy mit tudom én, mit
csináljon. Legjobb lesz, lökje ki onnan… lökje ki azt az embert.
– De hisz akkor üresen marad a szoba.
– Természetesen és minden esetre ez a legjobb.
– Legjobb? – kérdé Brunner úr bizonyos szemtelen mosolygással.
– Kire a legjobb? Hogy méltóztatik azt érteni?
– Ugy értem, hogy a szoba árát én fizetem.
Brunner majd hanyatt esett a csodálkozástól; de mégsem esett
hanyatt, hanem csak a kezeit dörzsölte.
– Rendben vagyunk, nagyságos uram. – Ez aztán beszéd, forgós
teremtette. Igy beszél egy úr, – dünnyögte magában, mikor a
szobából távozott intézkedni.
Másnap reggel azonban még nagyobb zenebonát csinált
Pantalovics. Csengetett s az első pincért, a ki megjelent meghajitotta
a csizmájával és követelte Brunner urat, hogy azonnal ide jőjjön,
mert le akarja lőni, mint egy átkozott verebet.
Brunner bejött nagy szepegve, Pantalovics fölemelt öklökkel
rohant feléje.
– Megint nem tudtam aludni, – bőgött fel mint egy vadállat, –
megint köhögött valaki a szomszédban.
– Az lehetetlen, – szólt Brunner úr flegmával – a szoba az
uraságodé és üres.
– Itt balról köhögött egész éjjel.
– Ah, balról? A Nr. 17-ben. Ugy már lehetséges.
– Ki cselekedte azt? – orditá Pantalovics.
– Ugyanaz a járásbiró, a kit tegnap volt szerencsém emliteni.
– Megint? Hiszen azt kilökte tegnap?
– Természetesen, eltávolitottam a Nr. 15-ből, mert azt nagyságod
vette ki, de beszállásolta magát a Nr. 17-be, mert az még üresen állt.
Pantalovics a fogait csikorgatta.
– Ön egy infámis ember, hallja! Ha rögtön ki nem hurcolkokik
onnan is az az úr, én megyek el egy más villába. Megértette?
– Igenis, igenis, – makogta a kényelmi tanácsos zavartan. – A mi
a szobából való kihurcolkodást illeti, azt értem, de a mi a szobát
illeti…
– Azt a szobát is én fizetem, – jelentette ki Pantalovics.
Ez megdöbbentette Brunner urat, mert ez már minden fogalmat
felülmult, a mit magának a gavallérságról alkotott. A mi sok, az már
gyanus. Mik ehez képest a legnagyobb gavallérok, a kiket ő ismert,
az osztrák főurak? Azoknak a nagyúri volta legfeljebb abban
nyilvánul, hogy fotográf-masinájuk van s ingyen veszik le a népet;
Pantalovics azonban parancsol és fizet, megfizeti a levegőt, a
virágillatot, a kilátást és még a csendet is. Pantalovics úr valóságos
üstökös a vendégek közt.
Bár még mindig piszkálta Brunner urat némi gyanakodás, mégis
teljes mértékben lenyomta minden egyéni akaratát a szertelen
tisztelet, melyet Pantalovics iránt érzett. Vakon engedelmeskedett
neki, legott elszállásolta a járásbirót és pedig ezuttal önzetlenül, sőt
nagylelküen, mert fent a második emeleten és lent a földszinten is
volt még a Pantalovicsé fölött egy-egy üres szoba, ahonnan esetleg
lehangzott vagy felhangzott volna éjjelenkint az idegbántó
köhécselés, de ő mindezek dacára, az épület másik szárnyába
helyezé el a vérköpős járásbirót. Közvetlen a Horváthyék szobája
mellé. Brunner úr finom lélek volt s úgy tudta a házat vezetni, mint a
hogy egy államférfi vezeti az országot, hogy minden egyes ténye
beszélni látszik a közönséghez. A járásbiró szomszédsága csak
kellemetlen lehetett mindenkire. A Horváthyékhoz való elhelyezés
ténye célzatokat rejt magában. S közelfekvőnek látszott az a föltevés
is, hogy az áthelyezés ebben az alakban a Kürtössy-család intrikáira
vezethető vissza.
Ilyen viszonyok közt fogamzott meg bennem az a terv, hogy
közbelépjek és a gonosz Ponci megbünhődjék, a derék Horváthy-
család pedig elégtételhez jusson. Ehhez pedig egy nálamnál
hatalmasabb munkatárs kellett. Kiszemeltem a sorsot. Mert a sors
néha a maga bolond fejétől is cselekszik, de a leggyakrabban okos
emberek mesterségesen fogják az ekéjük elé, ellátják a
szükségesekkel, és ráhagyják: no most már magadtól csináld
tovább!
Közben a Pantalovics alakja egyre nőtt a villa lakói előtt, mígnem
valóságosan legendáriussá vált, mint az utolsó Cobor grófé, ki
mahagoni fa tüzénél főzte meg angol vendégének a paprikás
gulyáshust, vagy az Eszterházyé, a ki lepuffantotta a tizezer forintos
lovat, mert olyan gebét nem használhat semmire. Mikor ugyanis
Pantalovics kifizette Brunnernek a heti számláját, visszajárt volna az
egyik százasból ötven forint, mire hanyagul intett a kezével: „Oszsza
ki a többit a cselédek közt.“
Forgós teremtette, ez már valami. Ez már tény. És milyen tény.
Brunner úr pedig a tények embere volt s kimondhatlan rajongást
kezdett érezni Pantalovics iránt, – a mi épen jól belevágott
terveimbe.
Egy napon a kis Ponci a darazsakkal foglalkozott. Egyik fészküket
kiásta olyan érdeklődéssel, mint azok, a kik Pompejit és
Herkulanumot hozták fölszinre. Épen a délutáni álmaikat aludták a
villabeli betegek, a kertben nem volt más, csak a Ponci.
No, ez a legkedvezőbb idő.
Leszaladtam egy közeli boltba és megvettem ott a legszebb
bádog trombitát, aztán visszasiettem vele a kerten keresztül, már
messziről rákiáltván a fiucskára:
– Poncikám lelkem, hoztam magának valamit!
Ponci élénken pillantott fel, hogy ki szól hozzá, de láthatólag
megcsappant a kedve, mikor engem ösmert fel a megszólitóban;
nem szaladt felém, mint a gyermekek szoktak ilyenkor, hanem csak
úgy félvállról kérdé:
– Mit?
– Egy szép trombitát.
S ezzel felmutattam a napfényben csillogó bádog játékszert.
Ponci nézte messziről, de meg se mozdult, mintha oda volna
gyökerezve.
– Hát nem jön ide?
Nem felelt és nem jött. A gyermekek ösztöne többet ér, mint az
öregek tapasztalása.
– Ej, ej Ponci! Hát nem kell a trombita? Pedig milyen hangja van!
No, akkor odaviszem én magam.
S mellőzve a kacskaringós utat, egyenest a gyepen siettem az
ajándékkal. Ponci azonban ezalatt egyre hátrált. A jó Isten tudja,
miféle érzés ösztökélte rá.
– Lássa Poncika ez már nem szép; a helyett, hogy megköszönné
az ajándékot, a mit viszek, a helyett, hogy pacsit adna, szökik
előlem, mintha valami harapós farkas volnék.
De beszélhettem én annak. A mennyire közeledtem én hozzá,
annyira távolodott ő tőlem. Egyszer csak ott voltam a
darázsfészeknél, de ő meg elszaladt a halas medencéhez. Úgy
néztünk egymással farkasszemet.
Közben gyönyörködtem a kibontott darázsfészekben, mely
csodálatra ragadhat mindenkit, a ki megnézi. Milyen remekmű! S mi
még oktalanoknak merjük nevezni az állatokat! Milyen nyegleség!
Majdnem az összes művészeteket, az egész ipart az állatoktól
tanultuk – de milyen nehezen. Az állatok ellenben semmit se
tanultak tőlünk, épen annyit tudnak, a mennyit a teremtés utáni első
nap.
A kis darázs már bizonyosan Ádám és Éva idejében tudta a
papirkészitést, az emberi müvészet ellenben még ma sem képes
megadni a kartonnak azt a könnyüséget és erősségét együtt.
Ezredévekig irtunk ónra, kőre, vasra, pedig a papir már készen lógott
a fák gallyain. Csak oda kellett volna nézni. A kis darázs
tarisznyaformában kiakasztotta csodás szövöttjét a fák ágaira. És
milyen tökéletes, milyen finom! Az eső lefut a mázos felületéről s a
madár át nem birja vágni a csőrével. Az ember tapogatódzott,
küzdött a vegytan és technika akadályaival, pedig ott volt az orra
előtt a nagy titok a darázs tarisznyájában. Még a lefolyt utolsó
században is azt hitték egy ideig, hogy papirt csak rongyból lehet
csinálni. A darázs pedig járt, röpködött kevélyen a maga sárga-
fekete dolmánykájában s ujjongva döngte: „No, én növényi anyagból
dolgozom.“
Aztán micsoda családból való! Csupa művészek, csupa gyárosok,
csupa épitészek. És mennyit dolgoznak!
Minden évben egy házat építeni… De mit, egy házat! Egy egész
földalatti várost. Komplikáltat, művészit, mint a Westminster, s ezt
egyetlen darázs építi önerejéből, tótok nélkül. Mérnök, munkás,
pallér, minden ő maga.
Mihelyt a levegő melegedni kezd, üreget keres a földben; ha
talál, annyi mintha ingyen fundushoz jutna; ha nem talál, váj
magának. De hát van-e hozzá csákánya, ásója? Az ugyan nincs, de
adott neki az Isten erős állkapcát, azzal szurkálja ki a szükséges
lyukat. Egy körülfolyó karzat vezet egy-két láb átmérőjű üregbe, hol
az új városnak épülnie kell.
Mindenek előtt fejszére volna szüksége, melylyel a faszálakat
elhasogassa, hogy házának külső falait finom tépésszerű anyagból
megépítse. Fejszéje nincs, de pótolja a tapogató szarva. (Magad
uram, ha fejszéd nincs) s nincs az az ács, a ki ügyesebben dolgoznék
a szekercével, mint ő kelme azzal a szarvval.
De malter is kellenék a falak összeragasztásához. Majszter uram,
vagyis majszterné asszonyom a miatt se jön zavarba, mert a legjobb
malter a nyála. Hozzálát serényen s épiti a falakat, a padlatot, a
boltozatot, azután az erkélyt, ezt a pompás filigrán, félkerek müvet,
melyet tizenkét, csinos, könnyü oszlop tart s mely tele van
hatszegletes apró kamrácskákkal, alól minden kamra kis nyilással.
Egy egész darázs-kaszárnya. Mindenik erkélyen másfél ezer kamara.
Minden erkély után egy sor oszlop következik, aztán megint uj erkély
és megint oszlopok és megint erkélyek hatvanezer lakosra épitett
celákkal.
Mennyi művészet, mennyi pompa, – de mi haszna? Jön a kis
Ponci és kiássa, szétrombolja az egész várost. Hát legyen aztán ilyen
körülmények közt valakinek kedve darázsnak lenni és nem csipni,
nem dongni. Az ördög tartsa meg az egykedvüséget. Csak azért is
dongó, diri-diri-dongó.
– De szép ez a nagy darázsváros, Poncika. Tudok én még annál
egy nagyobbat. Jőjjön csak, megmutatom.
De Ponci makacsul állt meg a szökőkutnál és hogy az alatt se
teljék az idő hiába, az arany-ezüst halakat dobálgatta kövekkel, csak
néha pillantott felém lopva, hogy ott vagyok-e még?
– Hát nem kell a trombita? Szóljon már Ponci. Mert akkor másnak
adom.
Ponci nem felelt, konok dac ült a homlokán és az ajkai körül,
melyeket összeszoritott, a szemeit pedig leszegezte a földre, mint
egy bakonyi zsivány.
– Jól van, nem bánom hát, ha nem jön is; ide teszem a trombitát
az aloé levelére, innen vegye el, ha akarja. Pá, pá, Poncika!
Ezzel ott hagytam a trombitát s a villa felé indultam, hogy a
szobámba menjek. Utközben azonban eszembe jutott, hogy jó lenne
kilesni a fiut, mit fog csinálni, elbujtam tehát egy fenyves gruppban.
Lassan közeledett a darázsfészek helyére s ott megállt kezeit
hátratéve, minden oldalról jól megnézegette a trombitát, mely az
aloé pléh-szinü husos leveléből látszott kezdődni, mintha virágja
lenne. Szép volt, nagyon szép volt, nem birt megválni tőle a
tekintete, de azért még sem mert hozzá nyulni. Nem bizott bennem,
nem hihette, hogy az örömét keresem. Érezte, hogy valami
veszedelem van a trombitában, de nem birt ellentállni.
Két fapálcikát tört a jávorfa galyról s azokat összetéve, mint
csiptetőt, lenyult, fölemelte velök nagy óvatosan a játékszert és igen
csodálkozott, hogy semmi baja sem lett. A játékszer nem lőtt, nem
ugrott ki belőle valami kis ördög, nem frecscsentett semmi mérges
nedvet a szeme közé, egy tökéletesen ártatlan trombita volt, egy
cseppet se rosszabb annál, melylyel Gábriel főangyalt festik, pedig,
ki tudja miért, de ugy gondolta, hogy pokoli meglepetés jön ki
belőle, mint a hogy az némely játékszereknél előfordul; a kettétört
zsemlyéből kiugrik egy egérke, a zöld-selyem káposztafejből kipattan
egy nyul és muzsikálni kezd. Csakhogy ezek mind kedves, bohókás
dolgok. Hanem a trombitából valami vérfagyasztó szörnyeteg bujik ki
és talán föl is falja.
Valóságos örömkiáltásban tört ki, hogy a trombita használható,
mindamellett messze tartotta el magától, mint valami
dinamittöltényt, miközben aláhajolt és ugy nézett be a csövébe. No
az bizony épen csak olyan volt, mint a többi trombitáké. Semmi
gyanús, semmi rendellenes nincsen benne.
Merész elhatározással kezébe vette és bele fujt.
– Trom prom, tru ru, rú rú.
Élesen, hatalmasan bugott és harsogott a mélységes csöndben.
Mert kihalt, hangtalan volt az egész kert. Csak a méhek és a
darazsak zümmögtek a virágokon. No, ezeknek a zöngését
ugyancsak elnyomta a trombita. Mert a kis Ponci mindinkább
beleszeretett a hangjába, fujta lélekszakadtig. Cseresznyétől
maszatos pofácskái kidagadtak, mint két pampuska.
Most már jó kerékvágásban van minden, siettem fel
megelégedetten a szobámba, várni az eredményeket. De már is
mutatkoztak. Pantalovics rohant le velem szemben a lépcsőkön
hálóköntösben, hajadonfővel, majd feltaszitott.
– Brunner! Hej Brunner! Hollá! Brunner!
Hátra fordultam. Brunner úr megszeppenve jelent meg a lépcsők
alján.
– Hallja ezt? – rivall rá Pantalovics. – Hallja azt a trombitát? Meg
kell ettől őrülni. Ki cselekszi ezt?
Brunner úr mindenek előtt lekapta házi sapkáját a nagy
Pantalovics előtt, aztán a ház homlokzata felé szaladt, honnan
betekintett a kertbe.
– Hagyja el, hagyja el, – kiálta könyörgő hangon Poncinak. – Oh,
Szüz Mária, Szüz Mária, ne hagyj el minket!
Ponci azonban most egy hängematteban hanyattfekve és
himbálózva, csak tovább is fújta roppant nagy kedvteléssel, mint Pan
az ő sípját, hogy se nem hallott, se nem látott azon kivül egyebet.
– Ki az az istentelen? – ordítá mind jobban feldühödve
Pantalovics.
– Egy fiúcska, nagyságos uram, egy kis fiúcska, – dadogta
Brunner úr alázatosan.
– No hát, menjen oda és verje meg jól azt a gaz kölyköt.
A kényelmi tanácsos elsápadt.
– Az lehetetlen, lehetetlen. Kürtössy császári és királyi
kamarásnak a fia… egy kamarásnak a fia, egy kamarásé.
Pantalovics elkékült a dühtől. Levegő után kapkodott, mint a
fuldokló.
– Lehetetlen? Mit locsog maga össze-vissza? Hát nincs keze, a
mivel elverje?
– De egy kamarás, egy kamarás fia, a ki maga is valamikor
kamarás lesz.
Pantalovics kiugrott volna talán a bőréből is, ha a nagy zajra oda
nem siet az ápolóné.
– Eredj Zsuzsa és verd meg azt a trombitáló gyereket, de csak a
fejét üsd, hogy meg ne sántuljon.
A Zsuzsa nem volt rest, nem kérette magát, ha egyszer az úr
mondja, – rohant, mint a szél. Félpercre rá aztán megszünt a
trombitahang, mintha ollóval vágták volna el, mély csönd lett utána,
felváltván azt hamar a Ponci jajkiáltásai.

É
Én már akkor fent voltam a szobában és az ablakból néztem,
hogyan páholja Zsuzsa a kapálódzó, rúgó, harapó Poncit, csihi-puhi
üti jobbról, pif-paf üti balról, a hol éri, a Ponci bőg, apját, anyját
hivja rettenetes üvöltő hangján.
A villa betegei megriadva futnak ki szobáikból. Jaj, kit nyúznak?
Hihettek-e szemeiknek, hogy a kis despotát, a Kürtössy Poncit
deklinálja a parasztasszony, az új lakó gazdasszonya? No, ez már
mégis sok. Szent Isten, mi történik, ha a méltóságos kamarás úr
észreveszi?
Szörnyülködtek, de beavatkozni nem mertek. Az egyik Peregi
kisasszony oda akart menni, de az anyja visszatartotta.
– Maradj veszteg Mici, még téged is meg talál ütni és úgy se
tartozol még a családhoz.
– Istenem, istenem – sopánkodott egy öreg asszony (egy
árvaszéki birónak a neje Egerből), – ha ez ötven év előtt történik és
például, ha Bártfán történik, hogy rohanna most elő egy huszár és
hogy vágná le a fejét annak a parasztasszonynak.
– Hja a hely és az idő! – sóhajtott fel egy köszvényes aggastyán
a mankójával hadonászva, – két nagy faktor. De hol lehetnek a
szegény Ponci hozzátartozói?
Valóban attól lehetett félni, hogy a parasztasszony magától is
megelégli a Ponci büntetését s a néző kompánia elesik a legnagyobb
élvezettől, hogy t. i. a kamarás vagy a hadnagy talál előtoppanni s
megtámadván a gazdasszonyt, arra Pantalovics is kicsörtet a gyöpre;
az lenne csak igazi hadd el hadd.
És csakugyan jött Kürtössyné, teljes negligében futott ki
szobájából, nem nézvén se jobbra, se balra, fellökve virágcserepet,
öntöző kannát, furiában rohant, mint a nőstény tigris, ha hallja
kölykének szivettépő orditását. Nem úri asszony többé, vége a
fölszedett társadalmi máznak, most csak anya, s ráveti magát egész
elszántan Zsuzsa asszonyra.
– Huh, te bestia, ereszted el mindjárt a gyermekemet!
S a vézna, törékeny teremtés, a kit a szél is majdnem elfújt,
olyan erővel rázta meg a hatalmas Zsuzsát, hogy az meglepetésében
eleresztette Poncit, a ki szörnyű visitással, a ház felé száguldva
mentette az irháját.
Zsuzsa asszony idegen körmöket érezvén fúródni nyakába, csak
egy percig volt meglepetve; amint megpillantá ellenfelét, fitymálón
mosolyodott el.
– Oh no, kis csutak! Mit akar? Hiszen mindjárt összeroppantom,
mint egy bolhát, ha magához nyúlok. Ugy? Maga az anyja a
gyereknek? No, szült volna inkább egy kopókölyköt. Össze-vissza
harapott a pokolra való. Hanem ereszsze el a torkomat, mert
megtalálom taszitani.
Főlénynyel bánt vele, mint egy nagy medve a menyéttel, de
Kürtössyné nem látott, nem hallott, csak ütötte a kis csontos
kezeivel, a hol érte. Nem igen fájhatott az annak, de azért mégis
megsokalta, megrestelte.
– Ej, menjen a pokolba! Nem szégyenli magát úri asszony létére
verekedni, – s olyat taszitott rajta, hogy az neki tándorodék egy
fának s részint a lökéstől, részint az ijedelemtől vagy a dühtől ájultan
esett össze a gyepen.

Ily szörnyű következményeket hozott a kis trombita. Ez már sok


volt. Ennyit magam sem akartam. És ha ezzel legalább bevégződött
volna a kinos affaire, de a hogy az igazi verekedéseket egy
diplomáciai háború előzi meg, ezt megforditva, egy diplomáciai
háború követte.
Kürtössyék, kivált a férfiak, hallván a történteket, haragra gyúlva
követelték, hogy Zsuzsa asszony rögtön hagyja el ezek után a villát.
Zsuzsa asszony hallani sem akart erről, kihivóan felrakta kezeit a
csipőire.
– Én innen egy tapodtat se mozdulok, hanem ha már annyiban
van, megmutatom nekik, hogy ők pusztulnak el innét.
Brunner úr próbálta kiegyengetni a dolgokat, de nem lehetett. Az
elkeseredés nőttön-nőtt, különböző üzengetések és apró
boszantások révén, ugy, hogy végre ultimátum gyanánt állitották
Brunner úr elé a kérdést: „Vagy én megyek vagy a másik.“ Kinos
órák voltak ezek a szegény Brunner úr életében. Nemcsak a villát,
hanem az egész fürdőközönséget lázas izgatottságban tartotta a
Kürtössy-Pantalovics-ügy, mint érdekfeszitő sakkjátszma. Vajjon
merre dől? A világ szeme Brunneren csüggött, a kinek három napot
adtak gondolkozásra. Brunner úr nagynak, fönségesnek,
hatalmasnak érezte magát e három napon, de éjjeleit
álmatlanságban tölté a kérdés latolgatásában. A kávéházakban, a
kurszalonban, a sétányokon és az inhaláló termekben nyilvános
fogadások történtek: ki lesz a győztes.
Az előkelő osztálybeliek lehetetlennek tartották, hogy mikor egy
rangbeli dámán olyan violentia esik, ne neki szolgáltassák elégtétel.
– Ha Pantalovics gentleman, – mondák, – ő sem forcirozhatja a
szolgálója diadalát.
De ez nem volt egyhangú nézet.
– Eh bolondság, – vélték mások; – Pantalovics nem ejtheti el az
ápolónőjét (vagy tudja Isten mije). Hiszen azért hozta, hogy kell
neki. Pantalovics tehát solidaris vele, s ha kilökik, őt is kilökik.
Leginkább egyes kiszivárgó hirek hoztak csiklandós hullámzást a
kedélyekbe. Emberek, a kik Brunnerrel beszéltek, (pedig mindenki
igyekezett szóba állni a nevezetes férfiuval) egyes elejtett
megjegyzéseit kolportálták, mint egykor a Bismarckéit, s azokra
épitve kombinálták ki a történendőket.
Valaki azt mondta volna állitólag a kovácsműhelyben, a hol
Brunner úr a lovait patkoltatta: „No, végre is nem nehéz választani a
kamélia rózsa és a laboda közt.“
Mire igy felelt Brunner úr.
– Hm, hm. A gondozott kertekben karóstul állanak a növények és
ha karóstul számitanának is, föltéve, hogy egy kamélia mellett egy
ezüst karó volna beszúrva, a laboda mellett ellenben egy arany karó,
minden okos ember a labodát választaná.
Ez az ártatlan kijelentés valóságos pánikot idézett elő a Kürtössy-
párton, mig ellenben a Pantalovicsék vitorláit kedvező szél lengette
vigan. De még két nap volt hátra, ez alatt sokat lehet csinálni.
Kürtössy az ősi familia becsületét látván kockán, mindent
megmozgatott, hogy a nagy szégyent elháritsa. Jó lábon volt a
környék összes főuraival, köztük a szomszéd kastélyban nyaraló
stájer kormányzóval is. A második nap sorba látogatta őket,
elmondván nekik a dolgok mibenlétét, mire azok harmadnap
visszalátogatták s fényes négylovas hintókkal telt meg a Verona
udvara, Brunner úr szive táncolt örömében, kevélységében. Hát még
mikor a kormányzó ő excellenciája ő vele is kezet fogott s
megveregetvén vállát, mondá:
– Reménylem, hogy tisztelt barátom Kürtössy, jól fogja magát
önnél érezni, kedves Brunner. Járjon ön kedvében e derék úrnak.
Brunner arca sugárzott, s szemeit ájtatosan emelte föl ő
excellenciájára:
– A véremet is szivesen ontanám Kürtössy urért.
– Ön derék ember, – szólt a kormányzó meggyőződéssel, – adieu!
Brunner úr fülében égi zene gyanánt csengtek-bongtak e szavak
egész nap, egész éjjel – de elterjedtek azok a Kurortban is és a
Pantalovicsék akciái rohamosan szálltak lefelé.
Kürtössy a harmadik nap délutánján már annyira a nyeregben
érezte magát, hogy komót-sapkában sétált a kertben s az egyik
lugasra kitétette a nyomtatott táblácskát: „Reservirter Platz“, a mit
csak a főhercegek és a legnagyobb potentátok cselekesznek meg.
Kürtössy tüntetett. Kürtössy azt látszott ezzel kikiáltani a
közönségnek: „Itt én vagyok az úr.“
Pantalovicsnak én hordtam a külömböző hireket, első napon a
jókat, azután a roszakat. Ő csak mosolygott akkor is, most is, és
nem jött ki a flegmájából.
A döntő reggelen azután komoly ünnepélyességgel, vésztjósló
arccal jelent meg Brunner úr a szobájában; – lelke ez alkalommal oly
kemény volt, mint az inggallérja. Magában ismételgette: a macska
fél, de én nem félek, a macska enged; de én nem engedek.
Azt hitte, nagy atakot fog kelleni kiállania Pantalovicstól, a ki
majd Kürtössy ellen igyekszik őt megforditani – de hát ez már
lehetetlen, a kormányzó miatt is.
Pantalovics azonban egykedvűen pöfékelt garasos
cseréppipájából, mikor belépett.
– Üljön le, kedves Brunner úr.
– Köszönöm, de csak röviden kivánom elmondani álláspontomat
abban a kinos ügyben, hisz tetszik tudni…
Pantalovics ásitott.
– Tudom, tudom, de hagyjuk azt még… néhány percig. Valami
egyebet hallottam. Azt tudniillik, hogy ön tavaly árúba bocsátotta a
Veronát.
– Igen, alkuban voltunk egy gráci patikáriussal, de nem jött létre
az egyezség.
– Miért?

Ő
– Mert nagy differencia volt köztünk. Ő hatvanezer forintot igért,
én nyolcvanat kértem.
– Nyolcvanért tehát eladó?
– Oh igen, – szólt Brunner úr türelmetlenül.
– Top – csapta a markát Pantalovics a Brunner úr kezébe, aztán
oda kiáltott a Zsuzsának, a ki az erkélyajtó üvegtábláit törölgette:
– Keresd meg a bugyellárisomat Zsuzsa, ott van valahol a tegnapi
kabátom belső zsebében és fizess ki belőle ennek az úrnak nyolcvan
ezrest!
Brunner úr nagy szemeket meresztett s olyan lélekzetet vett,
mint a harcsa, ha vizet öntenek rá. Csóválta a fejét, szikráztak a
szemei s a mig Zsuzsa asszony egyenként olvasta markába
megnyálazott ujjakkal az ezreseket, csodálkozva motyogta: „Forgós
teremtette, forgós teremtette!“
– Most pedig áttérhetünk egyébre, – mondá Pantalovics, kiverve
a pipája hamvát, – akart ön valamit mondani?
– Oh semmit, semmit.
– Akkor hát rendben vagyunk. Csak tessék leülni és megirni az
adás-vételi szerződést, majd mindjárt behivok két tanút is. A villát
Szabó Zsuzsánna vette meg öntől – minthogy én neki ajándékozom
a vételi összeget. Ön ha tetszik, tovább is megmaradhat itt
házfelügyelőnek, de viszont követeli az új tulajdonos, hogy azok a
népek, tudja azok a Kürtössyék, még ma takarodjanak ki a házából.
Ki is mentek még aznap. A méltóságos kamarás úr most már a
tulajdon kezeivel is jól elnáspángolta a Poncit, a ki miatt a familia
tekintélye ekkora csorbát szenvedett. Csend és béke költözött
ezentúl a Veronába és a kert darazsai, ha az emberekhez hasonlóan
krónikát vezetnek az őket érő nagy eseményekről, bizonyosan ilyes
valamit iktattak be az annálékba: „És ma vonult el területünkről,
illetve a kontinensről ama rettenetes óriás, a ki megtizedelte fajunkat
s romba dönté házainkat, városainkat.“
Lábjegyzetek.
1) Falun a maszlag szúrós bogyóját nevezik a gyerekek
tehénkének, persze olyan joggal, mint a fazekak füleit lovaknak.
Ahol nincs játékos bolt, ott is megvannak azért a játékok.
M. K.
2) A család cimere egy kecske.
M. K.
3) Tó Pozsonymegyében, a magyarországi vadkacsák kedvenc
mulatóhelye – Rivierája.
4) Gyakori eset, hogy az elpusztult anya helyett idegen réce
jelenik meg a fészekben és segit a költést befejezni.
M. K.

Javítások.

Az eredeti szöveg helyesírásán nem változtattunk.


A nyomdai hibákat javítottuk. Ezek listája:

7 ügyeljen rájok. ügyeljen rájok.“


8 leszármazottakat illesse. leszármazottakat illesse.“
23 Porovka, Itt Porovka. Itt
24 vele egyszere vele egyszerre
33 Ellenszevezik velök Ellenszenvezik velök
42 Nehez dolog Nehéz dolog
62 a juhot. a bárányt a juhot, a bárányt
77 „A–t“ mond „A-t“ mond
157 az nem baj, az nem baj.
179 mint a napfény, mint a napfény.
181 izé De nem izé. De nem
295 elháritsa, Jó elháritsa. Jó
*** END OF THE PROJECT GUTENBERG EBOOK ÖREG SZEKÉR
FAKÓ HÁM: ÚJABB ELBESZÉLÉSEK ***

Updated editions will replace the previous one—the old editions


will be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States
copyright in these works, so the Foundation (and you!) can copy
and distribute it in the United States without permission and
without paying copyright royalties. Special rules, set forth in the
General Terms of Use part of this license, apply to copying and
distributing Project Gutenberg™ electronic works to protect the
PROJECT GUTENBERG™ concept and trademark. Project
Gutenberg is a registered trademark, and may not be used if
you charge for an eBook, except by following the terms of the
trademark license, including paying royalties for use of the
Project Gutenberg trademark. If you do not charge anything for
copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such
as creation of derivative works, reports, performances and
research. Project Gutenberg eBooks may be modified and
printed and given away—you may do practically ANYTHING in
the United States with eBooks not protected by U.S. copyright
law. Redistribution is subject to the trademark license, especially
commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the


free distribution of electronic works, by using or distributing this
work (or any other work associated in any way with the phrase
“Project Gutenberg”), you agree to comply with all the terms of
the Full Project Gutenberg™ License available with this file or
online at www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand,
agree to and accept all the terms of this license and intellectual
property (trademark/copyright) agreement. If you do not agree
to abide by all the terms of this agreement, you must cease
using and return or destroy all copies of Project Gutenberg™
electronic works in your possession. If you paid a fee for
obtaining a copy of or access to a Project Gutenberg™
electronic work and you do not agree to be bound by the terms
of this agreement, you may obtain a refund from the person or
entity to whom you paid the fee as set forth in paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only


be used on or associated in any way with an electronic work by
people who agree to be bound by the terms of this agreement.
There are a few things that you can do with most Project
Gutenberg™ electronic works even without complying with the
full terms of this agreement. See paragraph 1.C below. There
are a lot of things you can do with Project Gutenberg™
electronic works if you follow the terms of this agreement and
help preserve free future access to Project Gutenberg™
electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright
law in the United States and you are located in the United
States, we do not claim a right to prevent you from copying,
distributing, performing, displaying or creating derivative works
based on the work as long as all references to Project
Gutenberg are removed. Of course, we hope that you will
support the Project Gutenberg™ mission of promoting free
access to electronic works by freely sharing Project Gutenberg™
works in compliance with the terms of this agreement for
keeping the Project Gutenberg™ name associated with the
work. You can easily comply with the terms of this agreement
by keeping this work in the same format with its attached full
Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.

1.E. Unless you have removed all references to Project


Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project
Gutenberg™ work (any work on which the phrase “Project
Gutenberg” appears, or with which the phrase “Project
Gutenberg” is associated) is accessed, displayed, performed,
viewed, copied or distributed:

This eBook is for the use of anyone anywhere in the United


States and most other parts of the world at no cost and
with almost no restrictions whatsoever. You may copy it,
give it away or re-use it under the terms of the Project
Gutenberg License included with this eBook or online at
www.gutenberg.org. If you are not located in the United
States, you will have to check the laws of the country
where you are located before using this eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is


derived from texts not protected by U.S. copyright law (does not
contain a notice indicating that it is posted with permission of
the copyright holder), the work can be copied and distributed to
anyone in the United States without paying any fees or charges.
If you are redistributing or providing access to a work with the
phrase “Project Gutenberg” associated with or appearing on the
work, you must comply either with the requirements of
paragraphs 1.E.1 through 1.E.7 or obtain permission for the use
of the work and the Project Gutenberg™ trademark as set forth
in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is


posted with the permission of the copyright holder, your use and
distribution must comply with both paragraphs 1.E.1 through
1.E.7 and any additional terms imposed by the copyright holder.
Additional terms will be linked to the Project Gutenberg™
License for all works posted with the permission of the copyright
holder found at the beginning of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files
containing a part of this work or any other work associated with
Project Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute


this electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the
Project Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must,
at no additional cost, fee or expense to the user, provide a copy,
a means of exporting a copy, or a means of obtaining a copy
upon request, of the work in its original “Plain Vanilla ASCII” or
other form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™
works unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or


providing access to or distributing Project Gutenberg™
electronic works provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like