Being a web developer is one of the most beautiful jobs there is, but also one of the most demanding. You need to stay up to date at all times and learn actively instead of resting on your oars. Adapting to new requirements is key. Basic SEO knowledge is required, and you need to acquire new techniques such as responsive web design. Being able to optimize websites is important, and of course, getting to know new working methods is vital. To ensure that you stay on top of the game, we’ve collected a list of the best tools and resources for web developers.
Lifelong Learning: Resources for Web Developers
Newsletter for Web Developers
These newsletters bring you the best articles on web development and performance and are editorially prepared. This way, you can be sure to only find useful things in your inbox.
Web Operations Weekly – A newsletter on web applications, performance, web development, server technology, and tips.
WEB TOOLS WEEKLY – A newsletter on the latest tools for web developers and web designers. Mainly deals with front-end design.
freshbrewed.co – This newsletter about Front-end and UX design is published once a week.
Communities for Web Developers
Every web developer gets stuck at some point and doesn’t know how to continue. That’s when it is helpful to be able to talk to other people that can give support fast and unbureaucratically. Here are some communities specifically for web developers and designers.
Stack Overflow: 4.7 million programmers and developers help you fast.
Front-end Front: A community specifically for front-end developers. Here, you can ask questions and share important links.
Hashnode: A global community of software developers made to network and learn from each other.
Refind: A community that collects and shares the best links of the web.
Facebook WordPress Front-end Developers Group: This is a new group for developers that want to ask and answer questions, share their work with others, or discuss new, upcoming trends.
/r/webdev: The most recent news on web design and web development.
Tools for Online and Offline Use: Resources for Web Developers
Website Speed Test Tools
A website’s speed is a crucial factor in its ranking in the Google index. Fast loading times often equal better bounce rates, a better general user friendliness, and higher conversion rates. Thus, I recommend using these free tools to test and optimize your website’s loading time.
Website Speed Test: The rather new speed test tool by KeyCDN with “cascade” display of the results and a preview of your website. Recommendable.
Google PageSpeed Insights: PageSpeed Insights analyzes your website and gives you many useful tips on how to improve the site’s performance.
Google Chrome DevTools: Explains the developer tools built into Google Chrome in a detailed way.
WebPageTest: This tool allows you to test the performance of your websites from many locations on earth in real browsers like Firefox, IE, and Google Chrome.
Pingdom: One of the best tools to test a website’s loading time. Different locations can be set.
GTmetrix: Gives you an insight into your website’s speed, and a bunch of tips to help you improve it.
Collaboration Tools
These tools ease cooperation of teams that work on one commission together. By now, many teams consist of workers that live and work scattered all over the world. Keeping in touch and arranging with each other is of particular importance. These tools allow you to make cooperation and workflow significantly more efficient.
Slack: A messaging applications for teams working on a commission. The app promises to make your work life easier and more productive.
Trello: Trello is a flexible and visual way of organising teams. The software is based on »cards” that are commented and to which you can assign priorities. It’s simple and can be learned quickly.
Glip: Glip provides real-time messaging with an integrated task manager, video conferences, shared calendars, and a lot more.
Asana: With this collaboration tool, teams can keep an eye on their work and look into existing results. A perfect way to see what stage the project is in.
Jira: All members of your software team can plan their work, look at results, and release the software afterwards.
Code Sharing and Experiments
Sometimes, you might have a fruitful conversation with another developer on Skype or via Google Hangouts, and want to share some code so that your interlocutor can take a look at it. Of course, large team tools like Slack can do that. However, they make no sense when you’re not part of a team. There are a couple good, and fast alternatives. Sometimes, even quick experiments are crucial, which is why you’ll find tools for that in this list.
JS Bin: A tool to experiment with programming and markup languages. You can use HTML, CSS, JavaScript, Markdown, Jade, and Sass.
JSfiddle: A tool that allows you to test your JavaScript, HTML, or CSS code directly within the browser.
Codeshare: Share your code with other developers in real time.
Dabblet: An interactive “playground” to enable quick testing of CSS and HTML snippets.
Diff-Checker Tools
The “diff checkers” help you visualize and, if wanted, connect differences between file versions. Sometimes it can be helpful to have such a visual display.
Diffchecker: An online tool for quick comparison of text-based files. Useful, when you’re on the go and need a quick comparison of two files.
Beyond Compare: A program to compare files and folders via simple, effective commands which determine the area you care about. Things that you’re not interested in can be faded out.
Markdown Editors
Markdown is a markup language with a simple syntax that can be converted into HTML (and other formats) fast. Note: Markdown editors can be used for desk work as well as simple code.
StackEdit: A free-to-use online editor for Markdown.
Dillinger: Dillinger is a cloud-capable HTML5 Markdown editor.
Mou: Markdown editor for developers that use Mac OS X.
Texts: A simple text editor for Markdown. Available for Windows and Mac OS X.
MarkdownPad: MarkdownPad is probably the best Markdown editor for Windows. It can directly provide a live preview next to the input area.
ByWord: ByWord is the definite favorite in the Noupe Team when it comes to editors for Mac.
A CSS preprocessor basically consists of a scripting language that expands CSS and can compile to regular CSS. CSS preprocessors ease working with CSS. Here’s an article on the basics of Sass and Less.
Sass: A very mature, stable, and efficient professional CSS expansion.
Less: An expansion of CSS that is also backwards compatible. This makes learning it a cakewalk.
Stylus: A new language that provides an efficient, dynamic, and expressive way of generating CSS. Stylus supports both indented and regular CSS.
Front-End Frameworks
Working with frameworks is becoming more and more popular, as using a predefined frame, or a compact package can ease work significantly, and allows you to get to results faster. Usually, frameworks consist of some files and folders, like CSS, HTML examples, and JavaScript. Twitter’s Bootstrap framework is one of the most popular frameworks of them all and the foundation of many sophisticated websites. However, other frameworks also deserve to be tested.
Bootstrap: An HTML, CSS, and JS framework for the development of responsive, mobile-first websites.
Foundation: A family of responsive front-end frameworks that are supposed to ease the development of responsive websites, apps, and emails.
Semantic UI: A framework for the development of responsive websites with semantic, readily understandable HTML.
Uikit: A lightweight and modular framework for the development of fast, efficient web interfaces.
Git: Clients and Services
Git is a source code management system for software and web development. It offers distributed version control. Git’s advantages become the most evident when working in teams, as code changes can be traced back, and brought from the development to the live stage. It’s a way of minimizing chaos, and to make sure that nothing goes online until it was tested.
SourceTree: A free Git and Mercurial client for Mac and Windows. A Git client for teams – Bitbucket – is available as well.
GitKraken (Beta): A free and intuitive, fast client available for all platforms.
Tower 2: Version control with Git made simple. This is what this app promises to do. Only for Mac.
GitHub Client: An easy way of working on projects on GitHub and GitHub Enterprise.
Astronomy, The field of biology, Biology, Entire world Medicine, Physics, External Scientific research.
Although many men and women believe about composition writing a project which is often only possible allotted in the sphere pointing to humanities, works are a basic version of training distinction with regards to organic and natural sciences as a result. But unfortunately, its fair to say, so nevertheless had comments prevalent major involving shed are indifferent, uncover certain peculiarities which actually truly must be landed in the event that re-writing this composition in this particular sphere:
First of almost all, that you’re likely start fantastic deal of background science taking note of to perform the process fruitfully.
Further located on, there’s a chance you’re alleged to select the best tips and give a necessary analysis of the malady.
Your essay should to, around consulting, present the people, explain turning into an actual systematic situation, it want . mindfully detailed on top of that summarized in affordable achievement.
A botanical confirmed report will have the reputation url site, an introduction, a primary your body equipped with proper part headings, a new in summary and simply set of tips to warrant and additionally supply our details.
In the most important introduction you might create the issue, city you see, the argument, interpret the patient and put up definitions on the package used as well as brief description your entire strategy this issue.
The main body to be able to put into departments that includes recommended brands, which probably around an unobstructed analysis coming of the subject, area why they separated for a popular view, work proper hard drive to suit dispute, existing records data in a choice of appearance not to mention mental types assuring evidences for many of the sources of information applied.
The conclusion should give you a summary restatement from your intent being dissertation and in addition the foremost direction from seek, and consequently not use the typical but briefly constructed conclusions, below we will its brings about and therefore signifying the likelyhood for further scientific tests.
The gait style all-natural discipline essay should be official with many unaggressive designs on the bandwith interpretation piece active.
The narrative article contains reminding an article through start to finish on date choose. Mcdougal is inspired toward successfully recount a chapter therefore running illustrative language of choice and consequently tidy company tricks most typically associated with reliable storytelling. The finished products isn’t really a absolutely free pouring effective account however a setup, intentional essay by way of an unveiling, internal system and consequently finalization. Story documents stop by way of a point in time — a moral or class — generally inspires as well as enlightens your readers.
google_ad_channel Equals ‘1496130777′; google_ad_client Implies ‘pub-0316265116163263′; google_ad_output Implies ‘js’; google_max_num_ads Implies ‘1′; google_ad_type Equates to ‘text’; google_image_size Means ‘180×150′; google_feedback Is equal to ‘on’; google_skip Equates to google_adnum; google_url Means ‘bottom’; google_label Is equal to ‘top’; google_label_text Equates to ‘Sponsored Link’;
Brainstorm Ideas
Most tutors assign tangible concepts the befit narrative essays.cheapest custom essays A couple of examples put in a bigger family and friends joy or possibly a crazy beginnings present. Some other educators doable higher education to produce most of the helpful hints. In cases, the youngsters preferably should think certain life experiences in order to locate a conference deserving of writing about that a lot of edges by having a lesson discovered or just a fresh, new wisdom simply because some of the situation. A terrible vehicle accident could actually tell a partner not to ever drink and drive. Executing having a location cover can easily development misperceptions of these misplaced. The exact story topic area most often will support such an figuring details.
Make a strong Outline
With a bunch suggestions out there, followers need thin their very own clues. The most important story dissertation concentrates just one event, far from being numerous mishaps. Thus, streamlining specific events of the story plot blocks that essay through veering near area. Our daily outline appears like a long plans chronicling what went down really first, using together with hang around around the common story. The finished profile reveals contacting attach otherwise remove duplicate content a number of the page content.
Write the new Draft
Writing account essays genuinely crisis numerous school students, but unfortunately drawing a good department at any given time simplifies further development. Any diet plan defines the background for the core contest. An thesis headline and also the end kind this appearance has anticipation and as well , refers into the forth-coming procedures. To illustrate, “When I really left behind your abode when labour why morning, I really didn’t know gaming would likely transformation an eternity.” Yourself from paper relays the recognized phase to the novel properly recognition proffers our own wisdom identified or maybe the insects reason for my article.
Revise how the Essay
Revisions in addition to evolves with regard to the paper seem to be least generate coming from a written, written follow within doc. This listing within pieces to look at calls for how the logical airflow in occurrences, the figure and excellence of identifiable features a evident a sense time and place. One other substance, creators just need to accurate by sentence structure, punctuation, transliteration as action-word tense. As with solid motion croping and editing, only the most lucrative, strong sectors of the background might want to take the previous form of unquestionably the narrative essay.
Many WordPress superpowers come from its flexible data architecture that allows developers to widely customize their installations with custom post types, taxonomies and fields. However, when it comes down to its search, WordPress provides us with only one-field form that often appears inadequate and leads site admins to adopt external search systems, like Google Custom Search, or third-party plugins.
In this article I’ll show you how to provide your WordPress installation with an advanced search system allowing the user to search and retrieve content from a specific custom post type, filtering results by custom taxonomy terms and multiple custom field values.
What’s the ROI on your social media marketing? If you’re like most companies and blog owners, you probably have no idea, and might not even be sure how to begin getting the quantitative measurements to establish that. But don’t let that fact get you down: it’s a problem that plagues even large organizations. Measuring social media marketing success isn’t a straightforward algorithm, and it’s hard to assign things like followers or likes any kind of monetary value.
After all, according to a variety of published sources, roughly 80% of individuals who like a business Facebook page will never go to it again.In general, there are three recommended ways to measure the success of any marketing you do on social media. It includes being able to quantify and measure your conversions, your engagement, and your reach. Most social media channels don’t provide the in-depth analytic and information you need to be able to quantify each of these key areas, and savvy website owners and marketers utilize social media management tools which can provide deeper data.
Your Brand’s Social Reach:
The primary goal of most social media marketing is to acquire new visitors and clients. With that in mind, reach is the primary objective: getting your brand in front of more unique individuals. The number of people who have seen or been exposed to your marketing efforts. These might be connections gained on LinkedIn, Facebook Likes or views, Twitter followers, subscribers, and clicks. But impressions should never be discounted! The reason is simple: not everyone who sees your marketing will be immediately interested in your brand. But it’s entirely possible that they’ll remember it later, and often individuals on social media who see a brand once will consider it more authoritative than a brand they have never seen. But unfortunately, reach is also difficult to put financial value to, because it can be difficult to tell if these same individuals later become visitors or clients. A great way to correct that issue is to calculate how many individuals must be reached before you get a conversion. Divide the amount spent on broadening your reach by the value you assign a conversion, and you have your ROI. Over time and with the use of analytics, you can discover what groups of individuals you reach are more likely to become conversions, which will also increase your social media marketing ROI. And there are plenty of great ways to streamline those efforts.
Your Brand’s Social Engagement:
Your reach is how many people see your marketing efforts: and engagement is the proportion of individuals who interact with it. This is everything from post likes, ratings, clicks, retweets, and comments. As a general rule of thumb, engagement happens only when people feel strongly about what you’re marketing. Engagement is often a factor of the quality of what it is you’re putting on social media, and keeping detailed tabs on your engagement data can help inform your marketing efforts by letting you know what’s popular… and what isn’t. Individuals who engage are usually much more likely to become subscribers or clients than those who don’t. Promoting and marketing materials which yield high engagement also expand your reach, increasing the ROI of your social media marketing. For example, if a user shares your post, it will likely become visible on their timeline, and may be seen by all their contacts. And social media users are far more likely to click on links shared by their friends than on in-site advertisements.
Conversions: The Ultimate Goal
Conversions are simply the actions that you’re wanting potential viewers of your marketing to take. If you’re trying to sell a product, than a sale of that product is a conversion. If you’re trying to gain newsletter subscribers, than a subscription is a conversion. Ideally, you should be able to assign every conversion a numerical value. Maybe this is the price of the average check-out in an online store; or the average amount you make in advertising for each subscriber. In all cases, conversions are the ultimate goal of your social media marketing. In an ideal world, the revenue generated from conversions and the numerical value of your reach the cost of your social media marketing. Accomplishing that is having a positive ROI. In the cases where it doesn’t, that’s having a negative ROI: and that’s not uncommon.
MBA Critical For World-wide Organization Occupation
Composing a fantastic thesis on small business is often a laboring job to accomplish. Picking a suitable subject matter, exploring supplies, and producing the thesis need a large amount of thought and weeks. And even now, after you finish producing, you have to edit your masterwork for ensuring the standard of it. The enhancing course of action is not really merely about examining for lexical mistakes. It also includes examining the precision with the data you give, the common sense within your points and also the references. Hence, it’s not astonishing that a lot of learners obtain it challenging to edit their thesis. Understanding several of the difficulties several company college students commonly practical experience may also help you produce a successful thesis. Choosing Catchy Words and phrases Even though a thesis demands you to put official worlds, that you are predicted to catch the attention of the reader through the starting of your thesis. Selecting catchy and within the very same time official terms is hard to accomplish. Factors turn into intricate in the event you don’t really master the subject you discuss about. Chances are you’ll wind up in composing tedious words in your thesis. In such cases, you can make the most beneficial usage of a business dictionary. Examining the Precision of the Facts While you may know, company handles a variety of regions. The subject to debate can differ, for example finance, accounting, marketing, management or human assets. Supplies for every subject on organization are available in a sizable variety. Whenever you type your thesis, you could possibly read many resources. It appears impossible to note the many materials. You may skip composing down some of the resources the place the data you use arises from. The answer on the difficulty is looking for elements you definitely will need. Just remove less important products whenever termpaperswriter.org/ you perform study. Checking the Logic on the Points Creating a thesis suggests presenting new conclusions. Your conclusions really should be supported by sensible arguments. In case you will not be informed about the subject you examine, you can find a large likelihood that you choose to point out irrelevant arguments. Even, you may create irrational arguments. If these a detail occurs, the standard of your thesis will lessen, naturally. In an effort to avoid the awful matter to take place, examine by means of your thesis various moments. Eliminate irrelevant arguments and take a look at to formulate sensible arguments. Referencing Sources Another issues company learners usually encounter is referencing resources. Typically, pupils do not know how it is always to reference resources inside a thesis properly. Actually, you will find various citation variations you may observe including the Present day Language Affiliation design, American Psychological Affiliation fashion and Harvard Referencing style. Having said that, it is not proposed that you choose to use a lot of quotations within your thesis. In the event you discover that there are numerous quotations with your perform, it is actually essential in your case to paraphrase several of the quotations within your personal words and phrases. Don’t forget about to say the supply. These are just some with the troubles you could knowledge. Modifying a thesis on business enterprise could get some time to finish. Studying your work out loud several situations is a terrific thing to try and do.
Chocolatey turned 5 years old recently! I committed the first lines of Chocolatey code on March 22, 2011. At that time I never imagined that Chocolatey would grow into a flourishing community and a tool that is widely used by individuals and organizations to help automate the wild world of Windows software. It’s come a long way since I first showed off early versions of Chocolatey to some friends for feedback. Over the last 2 years things have really taken off!
The number of downloads has really increased year over year!
Note: While not a completely accurate representation of usage and popularity, the number of downloads gives a pretty good context. Going up by 7 million in 2014 and then by almost 30 million downloads in one year really shows a trend!
Note: The Chocolatey package has about 1,000 downloads per hour. I shut off the statistics for the install script back in October 2015 due to the extreme load on the site, so the number of Chocolatey package downloads is missing some of the statistics.
History
Let’s take a little stroll through some of the interesting parts of Chocolatey’s history. The history of Chocolatey really starts when I joined the Nubular (Nu) team in summer 2010.
October 6, 2010 – NuGet is introduced. The Nu team had joined up with Microsoft in late August to work on NuPack (as it was called then).
February 2011 – Joke with other folks on the NuGet team at MVP summit that if we ever introduced a machine package manager, we’d call it Chocolatey NuGet because it wouldn’t be vanilla NuGet packages.
March 21, 2011 – First lines of Chocolatey are committed. The PowerShell version of Chocolatey represents the first public known use of PowerShell as an application and not just scripts and modules.
March 23, 2011 – First release of Chocolatey is 0.6.0. I hope you were not using it that early. ?
March 28, 2011 – I started talking about Chocolatey on the NuGet list.
March 29, 2011 – Svein Ackenhausen coins the term “cinst” that would be the main call for choco until 2013.
April 23, 2012 – After bouncing ideas off of Keith Dahlby and Aaron Lerch, I figure out how to do mocking for PowerShell testing (which Matt Wrock later puts into Pester proper). I also determine a proper way to structure a PowerShell application (function per file).
September 23, 2014 – I show the first C# version of Chocolatey at a conference where my first demo uses choco from non-Windows. There are a lot of murmurs in the crowd.
January 2016 – Moderation backlog is reduced to near zero and is now manageable thanks to the automation.
February 1, 2016 – First Professional Licenses of Chocolatey are shipped to Kickstarters.
March 21, 2016 – CloudFlare caching tweaks introduced on the community repository to handle the increased pressure that will come from tab completion for package names.
March 23, 2016 – Virus scan results shown on the community repository for packages.
This doesn’t represent everything that has happened. I tried to list out and attribute everything I could find and remember. There have been so many amazing package maintainers over the years, there are too many of you to possibly list. You know who you are. You have made the community what it is today and have been instrumental in shaping enhancements in Chocolatey.
Looking to the Future
The community has been amazing in helping Chocolatey grow and showing that there is a need that it fills. Package maintainers have put in countless and sometimes thankless hours to ensure community growth and consumers have really found the framework useful! Thank you so much! The next version of Chocolatey is coming and it is going to be amazing. Here’s to the next 5 years, may we change the world of Windows forever!
This tutorial is the final of a three-part series by Brad Westfall. We’ll learn how to manage state across an entire application efficiently and in a way that can scale without dangerous complexity. We’ve come so far in our React journey, it’s worth making it across the finish line here and getting the full bang-for-our-buck out of this development approach.
Redux is a tool for managing both data-state and UI-state in JavaScript applications. It’s ideal for Single Page Applications (SPAs) where managing state over time can be complex. It’s also framework-agnostic, so while it was written with React in mind, it can even be used with Angular or a jQuery application.
Plus, it was conceived from an experiment with “time travel” — true fact, we’ll get to that later!
As seen in our previous tutorial, React “flows” data through components. More specifically, this is called “unidirectional data flow” — data flows in one direction from parent to child. With this characteristic, it’s not obvious how two non parent-child components would communicate in React:
React doesn’t recommend direct component-to-component communication this way. Even if it did have features to support this approach, it’s considered poor practice by many because direct component-to-component communication is error prone and leads to spaghetti code — an old term for code that is hard to follow.
React does offer a suggestion, but they expect you to implement it on your own. Here’s a section from the React docs:
For communication between two components that don’t have a parent-child relationship, you can set up your own global event system. … Flux pattern is one of the possible ways to arrange this.
This is where Redux comes in handy. Redux offers a solution of storing all your application state in one place, called a “store”. Components then “dispatch” state changes to the store, not directly to other components. The components that need to be aware of state changes can “subscribe” to the store:
The store can be thought of as a “middleman” for all state changes in the application. With Redux involved, components don’t communicate directly between each other, but rather all state changes must go through the single source of truth, the store.
This is much different from other strategies where parts of the application communicate directly between each other. Sometimes, those strategies are argued to be error prone and confusing to reason about:
With Redux, it’s clear that all components get their state from the store. It’s also clear where components should send their state changes — also the store. The component initiating the change is only concerned with dispatching the change to the store and doesn’t have to worry about a list of other components that need the state change. This is how Redux makes data flow easier to reason about.
The general concept of using store(s) to coordinate application state is a pattern known as the Flux pattern. It’s a design pattern that compliments unidirectional data flow architectures like React. Redux resembles Flux, but how close are they?
Redux is “Flux-like”
Flux is a pattern, not a tool like Redux, so it’s not something you can download. Redux though, is a tool which was inspired by the Flux pattern, among other things like Elm. There are plenty of guides out there that compare Redux to Flux. Most of them will conclude that Redux is Flux or is Flux-like, depending on how strict one defines the rules of Flux. Ultimately, it doesn’t really matter. Facebook likes and supports Redux so much that they hired it’s primary developer, Dan Abramov.
This article assumes you’re not familiar with the Flux pattern at all. But if you are, you will notice some small differences, especially considering Redux’s three guiding principals:
1. Single Source of Truth
Redux uses only one store for all its application state. Since all state resides in one place, Redux calls this the single source of truth.
The data structure of the store is ultimately up to you, but it’s typically a deeply nested object for a real application.
This one-store approach of Redux is one of the primary differences between it and Flux’s multiple store approach.
2. State is Read-Only
According to Redux docs, “The only way to mutate the state is to emit an action, an object describing what happened.”
This means the application cannot modify the state directly. Instead, “actions” are dispatched to express an intent to change the state in the store.
The store object itself has a very small API with only four methods:
store.dispatch(action)
store.subscribe(listener)
store.getState()
replaceReducer(nextReducer)
So as you can see, there’s no method for setting state. Therefore, dispatching an action is the only way for the application code to express a state change:
var action = {
type: 'ADD_USER',
user: {name: 'Dan'}
};
// Assuming a store object has been created already
store.dispatch(action);
The dispatch() method sends an object to Redux, known as an action. The action can be described as a “payload” that carries a type and all other data that could be used to update the state — a user in this case. Keep in mind that after the type property, the design of an action object is up to you.
3. Changes are made with Pure Functions
As just described, Redux doesn’t allow the application to make direct changes to the state. Instead, the dispatched action “describes” the state change and an intent to change state. Reducers are functions that you write which handle dispatched actions and can actually change the state.
A reducer takes in current state as an argument and can only modify the state by returning new state:
// Reducer Function
var someReducer = function(state, action) {
...
return state;
}
Reducers should be written as “pure” functions, a term that describes a function with the following characteristics:
It does not make outside network or database calls.
Its return value depends solely on the values of its parameters.
Its arguments should be considered “immutable”, meaning they should not be changed.
Calling a pure function with the same set of arguments will always return the same value.
These are called “pure” because they do nothing but return a value based on their parameters. They have no side effects into any other part of the system.
Our first Redux Store
To start, create a store with Redux.createStore() and pass all reducers in as arguments. Let’s look at a small example with only one reducer:
// Note that using .push() in this way isn't the
// best approach. It's just the easiest to show
// for this example. We'll explain why in the next section.
// The Reducer Function
var userReducer = function(state, action) {
if (state === undefined) {
state = [];
}
if (action.type === 'ADD_USER') {
state.push(action.user);
}
return state;
}
// Create a store by passing in the reducer
var store = Redux.createStore(userReducer);
// Dispatch our first action to express an intent to change the state
var store.dispatch({
type: 'ADD_USER',
user: {name: 'Dan'}
});
Here’s a brief summary of what’s happening:
The store is created with one reducer.
The reducer establishes that the initial state of the application is an empty array. *
A dispatch is made with a new user in the action itself
The reducer adds the new user to the state and returns it, which updates the store.
* The reducer is actually called twice in the example — once when the store is created and then again after the dispatch.
When the store is created, Redux immediately calls the reducers and uses their return values as initial state. This first call to the reducer sends undefined for the state. The reducer code anticipates this and returns an empty array to start the initial state of the store.
Reducers are also called each time actions are dispatched. Since the returned state from a reducer will become our new state in the store, Redux always expects reducers to return state.
In the example, the second call to our reducer comes after the dispatch. Remember, a dispatched action describes an intent to change state, and often times carries the data for the new state. This time, Redux passes the current state (still an empty array) along with the action object to the reducer. The action object, now with a type property of 'ADD_USER', allows the reducer to know how to change the state.
It’s easy to think of reducers as funnels that allow state to pass through them. This is because reducers always receive and return state to update the store:
Based on the example, our store will now be an array with one user object:
store.getState(); // => [{name: 'Dan'}]
Don’t Mutate State, Copy It
While the reducer in our example technically works, it mutates state which is poor practice. Even though reducers are responsible for changing state, they should never mutate the “current state” argument directly. This is why we shouldn’t use .push(), a mutation method, on the state argument of the reducer.
Arguments passed to the reducer should be considered immutable. In other words, they shouldn’t be directly changed. Instead of a direct mutation, we can use non-mutating methods like .concat() to essentially make a copy of the array, and then we’ll change and return the copy:
var userReducer = function(state = [], action) {
if (action.type === 'ADD_USER') {
var newState = state.concat([action.user]);
return newState;
}
return state;
}
With this update to the reducer, adding a new user results in a copy of the state argument being changed and returned. When not adding a new user, notice the original state is returned instead of creating a copy.
There’s a whole section below on Immutable Data Structures which sheds more light on these types of best practices.
You may have also noticed that the initial state now comes form a ES2015 default parameter. So far in this series we’ve avoided ES2015 to allow you to focus on the main topics. However, Redux is much nicer with ES2015. Therefore, we’ll finally start using ES2015 in this article. Don’t worry though, each time a new ES2015 feature is used, it will be pointed out and explained.
Multiple Reducers
The last example was a nice primer, but most applications will need more complex state for the entire application. Since Redux uses just one store, we’ll need to use nested objects to organize state into different sections. Let’s imagine we want our store to resemble this object:
{
userState: { ... },
widgetState: { ... }
}
It’s still “one store = one object” for the entire application, but it has nested objects for userState and widgetState that can contain all kinds of data. This might seem overly simplistic, but it’s actually not that far from resembling a real Redux store.
In order to create a store with nested objects, we’ll need to define each section with a reducer:
ES2015 Alert! The four main “variables” in this example will not be changed, so we’ll define them as constants instead. We’re also using ES2015 modules and destructuring.
The use of combineReducers() allows us to describe our store in terms of different logical sections and assign reducers to each section. Now, when each reducer returns initial state, that state will go into it’s respective userState or widgetState section of the store.
Something very important to note is that now, each reducer gets passed its respective subsection of the overall state, not the whole store’s worth of state like with the one-reducer example. Then the state returned from each reducer applies to its subsection.
Which Reducer is Called After a Dispatch?
All of them. Comparing reducers to funnels is even more apparent when we consider that each time an action is dispatched, all reducers will be called and will have an opportunity to update their respective state:
I say “their” state carefully because the reducer’s “current state” argument and its returned “updated” state only affect that reducer’s section of the store. Remember, as stated in the previous section though, each reducer only gets passed its respective state, not the whole state.
Action Strategies
There are actually quite a few strategies for creating and managing actions and action types. While they are very good to know, they aren’t as critical as some of the other information in this article. To keep the article smaller, we’ve documented the basic action strategies you should be aware of in the GitHub repo that goes along with this series.
Immutable Data Structures
The shape of the state is up to you: it can be a primitive, an array, an object, or even an Immutable.js data structure. The only important part is that you should not mutate the state object, but return a new object if the state changes.” – Redux docs
That statement says a lot, and we’ve already alluded to this point in this tutorial. If we were to start discussing the ins and outs and pros and cons of what it means to be immutable vs mutable, we could go on for a whole blog article’s worth of information. So instead I’m only going to highlight some main points.
To start:
JavaScript’s primitive data types (Number, String, Boolean, Undefined, and Null) are already immutable.
Objects, arrays, and functions are mutable.
It’s been said that mutability on data structures is prone to bugs. Since our store will be made up of state objects and arrays, we will need to implement a strategy to keep the state immutable.
Let’s imagine a state object in which we need change a property. Here are three ways:
// Example One
state.foo = '123';
// Example Two
Object.assign(state, { foo: 123 });
// Example Three
var newState = Object.assign({}, state, { foo: 123 });
The first and second examples mutate the state object. The second example mutates because Object.assign() merges all its arguments into the first argument. But this reason is also why the third example doesn’t mutate the state.
The third example merges the contents of state and{foo: 123} into a whole new blank object. This is a common trick that allows us to essentially create a copy of the state and mutate the copy without affecting the original state.
The object “spread operator” is another way to keep the state immutable:
Object.assign() and spread operators are both ES2015.
In summary, there are many ways to explicitly keep objects and arrays immutable. Many devs use libraries like seamless-immutable, Mori, or even Facebook’s own Immutable.js.
I very carefully choose which other blogs and articles this one links to. If you’re not understanding immutability, read the reference links from above. This is a very important concept for being successful with Redux.
Initial State and Time Travel
If you read the docs, you may notice a second argument for createStore() which is for “initial state”. This might seem like an alternative to reducers creating initial state. However, this initial state should only be used for “state hydration”.
Imagine a user does a refresh on your SPA and the store’s state is reset to the reducer initial states. This might not be desired.
Instead, imagine you could have been using a strategy to persist the store and then you can re-hydrate it into Redux on the refresh. This is the reason for sending initial state into createStore().
This brings up an interesting concept though. If it’s so cheap and easy to rehydrate old state, one could imagine the equivalent of state “time travel” in their app. This can be useful for debugging or even undo/redo features. Having all your state in one store makes a lot of sense for these and many reasons! This is just one reason why immutable state helps us.
I didn’t mean to create a Flux framework. When React Europe was first announced, I proposed a talk on ‘hot reloading and time travel’ but to be honest I had no idea how to implement time travel.
Redux with React
As we’ve already discussed, Redux is framework-agnostic. Understanding Redux’s core concepts first is important before you even think about how it works with React. But now we’re ready to take a Container Component from the last article and apply Redux to it.
First, here is the original component without Redux:
ES2015 Alert! This example has been slightly converted from the original. It uses ES2015 modules and arrow functions.
Sure, it does its Ajax request and updates its own local state. But if other areas in the application need to change based on the newly acquired user list, this strategy won’t suffice.
With the Redux strategy, we can dispatch an action when the Ajax request returns instead of doing this.setState(). Then this component and others can subscribe to the state change. But this actually brings us to a question of how do we setup the store.subscribe() to update the component’s state?
I suppose I could provide several examples of manually wiring up components to the Redux store. You can probably even imagine how that might look with your own approach. But ultimately, at the end of those examples I would explain that there’s a better way, and to forget the manual examples. I would then introduce the official React/Redux binding module called react-redux. So let’s just jump straight to that.
Connecting with react-redux
Just to be clear, react, redux, and react-redux are three separate modules on npm. The react-redux module allows us to “connect” React components to Redux in a more convenient way.
We’ve imported the connect function from react-redux.
This code might be easier to follow from the bottom-up starting with the connection. The connect() function actually takes two arguments, but we’re only showing one for mapStateToProps().
It might look weird to see the extra set of parenthesis for connect()(). This is actually two function calls. The first, to connect() returns another function. I suppose we could have assigned that function to a name and then called it, but why do that when we can just call it immediately with the second set of parenthesis? Besides, we wouldn’t need that second function name to exist for any reason after it’s called anyways. The second function though needs you to pass a React component. In this case it’s our Container Component.
I understand if you’re thinking “why make it look more complex than it has to be?”, but this is actually a common “functional programming” paradigm, so it’s good to learn it.
The first argument to connect() is a function that should return an object. The object’s properties will become “props” on the component. You can see their values come from the state. Now, I hope the function name “mapStateToProps” makes more sense. Also notice that mapStateToProps() will receive an argument which is the entire Redux store. The main idea of mapStateToProps() is to isolate which parts of the overall state this component needs as its props.
For reasons mentioned in #3, we no longer need getInitialState() to exist. Also notice that we refer to this.props.users instead of this.state.users since the users array is now a prop and not local component state.
The code example makes an assumption about how the user reducer works which may not be apparent. Notice how the store has userState property. But where did that name come from?
What about the .users property of userState? Where did that come from?
While we didn’t show an actual reducer for the example (because it would be in another file), it’s the reducer which determines the sub properties of its respective state. To ensure .users is a property of userState, the reducer for these examples might look like this:
In our Ajax example, we only dispatched one action. It was called 'USER_LIST_SUCCESS' on purpose because we may want to also dispatch 'USER_LIST_REQUEST' before the Ajax starts and 'USER_LIST_FAILED' on an Ajax failure. Be sure to read the docs on Asynchronous Actions.
Dispatching from Events
In the previous article, we saw that events should be passed down from Container to Presentational Components. It turns out react-redux helps with that too in cases where an event simply needs to dispatch an action:
In the Presentation Component, we can do onClick={this.props.toggleActive} just as we did before but this time we didn’t have to write the event itself.
Container Component Omission
Sometimes, a Container Component only needs to subscribe to the store and it doesn’t need any methods like componentDidMount() to kick off Ajax requests. It may only need a render() method to pass state down to the Presentational Component. In this case, we can make a Container Component this way:
import React from 'react';
import { connect } from 'react-redux';
import UserList from '../views/list-user';
const mapStateToProps = function(store) {
return {
users: store.userState.users
};
}
export default connect(mapStateToProps)(UserList);
Yes folks, that’s the whole file for our new Container Component. But wait, where’s the Container Component? And why don’t we have any use of React.createClass() here?
As it turns out, the connect() creates a Container Component for us. Notice this time we’re passing in the Presentational Component directly instead of creating our own Container Component to pass in. If you really think about what Container Components do, remember they exist to allow the Presentational Component to focus on just the view and not state. They also pass state into the child view as props. And that’s exactly what connect() does — it passes state (via props) into our Presentational Component and actually returns a React component that wraps the Presentational one. In essence, that wrapper is a Container Component.
So does that mean the examples from before are actually two Container Components wrapping a Presentational one? Sure, you can think of it that way. But that’s not a problem, it’s just only necessary when our Container Component needs more React methods besides render().
Think of the two Container Components as serving different but related roles:
Hmm, maybe that’s why the React logo looks like an atom!
Provider
In order for any of this react-redux code to work, you’ll need to let your app know how to use react-redux with a component. This component wraps your entire React application. If you’re using React Router, it would look like this:
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import store from './store';
import router from './router';
ReactDOM.render(
<Provider store={store}>{router}</Provider>,
document.getElementById('root')
);
It’s not required, but there is another npm project called react-router-redux. Since routes are technically a part of UI-state, and React Router doesn’t know about Redux, this project helps link the two.
Do you see what I did there? We went full circle and we’re back to the first article!
Final Project
The final project guide for this series allows you to make a small “Users and Widgets” Single Page App:
As with the other articles in this series, each comes with a guide that has even more documentation on how the guide works at GitHub.
Summary
I really hope you’ve enjoyed this series as much as I have writing it. I realize there are many topics on React we didn’t cover (forms for one), but I tried to stay true to the premise that I wanted to give new users to React a sense of how to get past the basics, and what it feels like to make a Single Page Application.
While many helped, a special thanks goes to Lynn Fisher for the amazing graphics she provided for the tutorials!
One of the leading WordPress themes of 2015, Jupiter V5 already has over 30K paid users who now have access to 50+ Templates! From performing artists and bloggers, entrepreneurs and business owners, to corporations and nonprofit organizations, Jupiter V5 is sure to have a template that will fit your niche. Browse our template categories including, but not limited to, Business, Community, Food, Health, Shop, Technology, and MORE and find the perfect template to actualize your vision!
A Business WordPress Theme For All Seasons!
Use the Visual Composer tool included in Jupiter V5 to access 100+ shortcodes that allow you to customize nearly every aspect of your site without ever having to write one line of code. SEO-optimized, small in website size and updated with the latest trends and technologies, Jupiter V5 also boasts a Google PageSpeed Score over 90, making it the fastest WordPress theme on the market!
Powering 28,000 Websites From Different Niches!
With its intuitive and user-friendly Admin Panel and the mighty Visual Composer which can help you edit 100+ elements and access over 230 styles for your page, Jupiter V5 has made it absolutely easy to customise the templates and start your website in a matter of hours. Being a solid business WordPress theme, Jupiter V5 can help you establishing website that truly reflects your brand and business values. Just to mention a few of Jupiter V5 rich collection of features and capabilities, your powerful business website solution comes with:
18 Header Styles
1800 Icons
14 Custom Widgets
10 Custom Post Types
7 Unique Blog Styles
6 Portfolio Hover Animations
Main Navigation Hover Styles
3 Portfolio Styles
Free Add-Ons
Among the top WordPress themes of 2015, Jupiter V5 is a limitless WordPress framework with about 30K paid users. With its latest update, V5, Jupiter is now capable of creating you a website with the latest trends and technologies. Jupiter is the only theme with a Google PageSpeed score of 95+, making it not only the most powerful but now the fastest WP theme in the market. Thanks to its modular architecture your website size will be much smaller compared to other Multi-purpose themes, leaving you with just the right amount of page assets catered to what you need. We offer an ever-evolving template base with around 50 templates to choose from for your website, from every niche you can imagine. On top of that, you can expect one new template from us every week!
In order to participate follow artbees_design on Twitter! Tweet about this giveaway with #JupiterV5 hashtag and leave a comment below on why you think JupiterV5 will be useful to you or which template best suits your project or niche.
The giveaway starts on March 28, 2016 and will end on April 4, 2016.
There will be 5 randomly chosen winners.
In the last few years, the way we design infographics has changed significantly. Infographics have evolved from static graphics to rich, interactive experiences with animation and video elements, all tailored to the uniqueness of the content, instead of pressing it into a precast mold. For this round-up, I have collected some of the best of infographic design to see what these kinds of engaging and informative experiences can look like today.
Most of the infographics on this list were chosen to showcase different ways that designers have approached data visualization. However, there are also a few hybrids here that illustrate the disappearing boundaries between infographics and richer multimedia experiences in creating engaging content and compelling stories. Deviating from the traditional infographic form means that we tread into more complex media territory, but such experimentation with technology and narrative will be key in shaping the future of infographic design.