background preloader

React

Facebook Twitter

Redux best practices — Lexical Labs Engineering. Redux is the React framework that other flux frameworks recommend you use.

Redux best practices — Lexical Labs Engineering

It went 1.0.0 when I started writing this (and is at the time of publishing past 3.0.0!) And it’s still early days as to how to use it. Its author, Dan Abramov, has put together some great documentation, but it doesn’t yet fully address how to deal with engineering with Redux at scale — people are starting to ask, “are there any repos of non-trivial apps that use redux”. Testing in React: Getting Off The Ground — JavaScript Inside. A first look: the Low Level Approach Let’s start with a low level approach by using the React specific Test Utils.

Testing in React: Getting Off The Ground — JavaScript Inside

Test Utils enables a concept called shallow rendering, which simply means rendering a component one level deep, neglecting any child components. import TestUtils from 'react-addons-test-utils'; const renderer = TestUtils.createRenderer(); function shallow(Component, props) { renderer.render(<Component {...props} />); return renderer.getRenderOutput();} By implementing our own shallow function, we can simply call shallowRenderer internally and return a shallow rendered component. Enaqx/awesome-react. React.js Conf 2015 - Immutable Data and React. Christianalfoni WebApp Enthusiast. All standards, libraries, practices, architectures and patterns needs some time to evolve before becoming widely accepted.

christianalfoni WebApp Enthusiast

The flux architecture is no different. After Facebook released their React JS project the suggested flux architecture has evolved into many different shapes and colors. Some of them more accepted than others. In this article we are going to look at what challenges exists today with the flux architecture. We are also going to look at a solution that I think is a great contribution to the evolution of flux. Flux and Flux history If you have never heard about flux before I will give a very short decription. Verbosity Developers in the JavaScript world have become accustomed to very expressive and easy to use API's.

Async operations When you test your application it is better to do so if you can change the state of your store synchronously. Handle the same action in multiple stores Facebook suggests a waitFor method that can reference the other stores in your application. Flux inspired reactive data flow using React and Bacon.js - Reaktor. A few years ago I got introduced to reactive programming and Bacon.js, a FRP (functional reactive programming) library for Javascript.

Flux inspired reactive data flow using React and Bacon.js - Reaktor

React Native: Bringing modern web techniques to mobile. If you're new to React, you can read more about it on the React website.

React Native: Bringing modern web techniques to mobile

You can also get started with React Native for iOS, which was released at F8 2015 on the React Native website. It started with React We introduced React to the world two years ago, and since then it's seen impressive growth, both inside and outside of Facebook. Today, even though no one is forced to use it, new web projects at Facebook are commonly built using React in one form or another, and it's being broadly adopted across the industry. Material UI - Material Design React Components. Creating A Simple Shopping Cart with React.js and Flux. Now that we have our Actions defined, it is time to create our Stores.

Creating A Simple Shopping Cart with React.js and Flux

Each Store manages application state for a domain within an application, so we are going to create one for our product and one for our cart. Let’s start with our ProductStore: ProductStore.js Above, we define two private methods, loadProductData and setSelected. We use loadProductData to, unsurprisingly, load our mock product data into our _product object. We expose this data using the public methods getProduct and getSelected, which return their respective internal objects. Lastly, we register a callback to our AppDispatcher that uses a switch statement to determine if the supplied payload matches an action we want to respond to.

Next up, let’s create our CartStore: Building robust web apps with React: Part 1, in-browser prototypes. Whenever I look into the internals of web browsers and the protocols that make the web work I usually end up feeling uneasy.

Building robust web apps with React: Part 1, in-browser prototypes

The number of parts that can and do go wrong makes it incredible that anything we build works at all. The against-all-odds robustness comes from the fault tolerance and backward compatibility engrained into key parts of web stack. The browser will always do its best to output something useful whether it’s parsing a badly authored document, unable to retrieve dependencies or 10 years out of date. I think this fundamental property of the web gets forgotten. Our aspirations as developers are becoming increasingly aligned with expectations set by other platforms. I worry when I see sites that make JavaScript the lynchpin of getting at content now and for the future. The additional complexity of the code we’re delivering and extra work we’re shifting into the browser means users might not get anything when even a small problem occurs.

Quick, in-browser prototypes. React. A Simple Component React components implement a render() method that takes input data and returns what to display.

React

This example uses an XML-like syntax called JSX. Input data that is passed into the component can be accessed by render() via this.props. JSX is optional and not required to use React. Try clicking on "Compiled JS" to see the raw JavaScript code produced by the JSX compiler. Live JSX Editor Compiled JS A Stateful Component. ReactJS для глупых людей. Пытаясь разобраться с библиотекой от Facebook ReactJS и продвигаемой той же компанией архитектурой «Flux», наткнулся на просторах интернета на две занимательные статьи: «ReactJS For Stupid People» и «Flux For Stupid People».

ReactJS для глупых людей

Решил поделиться с хабравчанами переводом первой (а чуть позже и второй) статьи. Итак, поехали.TL;DR В течении долгого времени я пытался понять, что такое React и как он вписывается в структуру приложения. Это статья, которой мне в свое время не хватало. Enaqx/awesome-react.