background preloader

ReactJS For Stupid People

ReactJS For Stupid People
TL;DR I struggled for a long time trying to understand what React is and how it fits in the application architecture. This post is what I wish someone had told me. What is React? How does React compare to Angular, Ember, Backbone, et al? How do you handle data? Stop. Stop it right now. React is ONLY THE VIEW LAYER. React is often mentioned in the same breath as other Javascript frameworks, but "React vs Angular" doesn't make sense because they aren't directly comparable things. React gives you a template language and some function hooks to essentially render HTML. You absolutely cannot build a fully functional dynamic application with React alone. The Good After working with React for a while, I've seen three very important benefits surface. 1. This may be the most important benefit, even though it is not different from Angular templates. Say you have to update your site's header with the user's name upon log in. <header><div class="name"> Not Logged In </div></header> 2. 3. The Bad 1. 2. 3. Related:  React

React.js Introduction For People Who Know Just Enough jQuery To Get By · React for Designers Updates: Jul 15, 2016: Updated for React 15. I also heard React.js was good and recently spent some time playing with it. Now that I’m pretty comfortable with React, I decided to write a tutorial on this subject. Target Audience: People Who Know Just Enough jQuery to Get by Before I begin, I’d like to clarify who my target audience is. Zed Shaw, the author of “Learn Code the Hard Way” series, recently wrote an excellent blog post called Early v.s. I don’t want to make a similar mistake here. In this tutorial, I’m targeting the third group I mentioned: people who know just enough jQuery to get by. Designers who can do basic coding in HTML/CSS/jQuery. If you’re comfortable with JavaScript or any of the frontend frameworks like Backbone/Ember/Angular, this tutorial is NOT for you, and you’ll be very frustrated with my writing style. Also, if you already know React, you’ll be pretty upset with me as well because I’ll be talking mostly about states instead of immutability or componetization.

The Future of Web Development - React, Falcor, and ES6 | Widen Engineering In this article, I’m going provide a glimpse into the future of web development. You will gain a new perspective on structuring a user interface, server, and data endpoints. In other words, I will cover the full “stack” - both the browser and server code - and you will be able to examine and execute all of the referenced code in a fully-functional GitHub repository. Intermediate understanding of JavaScript. If you lack any of these qualities, you may still be able to navigate this article and the related code, but these gaps in your knowledge will likely prevent you from extending my code to support a more realistic or non-trivial scenario. The current stack at Widen has traditionally consisted of Java on the server, AngularJS for all of our browser-related code (within the last few years), Jersey for REST API support, and a whole host of other various libraries such as jQuery, underscore, lodash, jQuery UI, and Bootstrap. A new and shiny approach. A futuristic stack React Falcor Webpack

Tyler McGinnis » React.js Tutorial Pt 1: A Comprehensive Guide to Building Apps with React.js Table of Contents: Pt I: A Comprehensive Guide to Building Apps with React.js. Pt II: Building React.js Apps with Gulp, and Browserify. Pt III: Architecting React.js Apps with Flux. Pt IV: Add Routing to your React App with React Router. Pt V: Add Data Persistence to your React App with Firebase. Pt VI: Combining React.js, Flux, React Router, Firebase, Gulp, and Browserify. React.js The Bigger Picture: By now you’ve probably heard about facebook’s React. As you’ve started to learn React you’ve probably ran into this problem. As mentioned above, this blog series will have six parts. Pt II: Building React.js Apps with Gulp, and Browserify. Pt III: Architecting React.js Apps with Flux. React.js Fundamentals: Components are the building blocks of React. What makes React so convenient for building user interfaces is that data is either received from a component’s parent component, or it’s contained in the component itself. Above we have a picture of my Twitter profile. Component LifeCycle Events

Trying out React - Artsy Engineering We recently picked up a Rails application that was a few features away from completion. This application allows our Genome Team to classify multiple artworks based on visual and art historical characteristics. These characteristics, or "genes", can be added, removed, and changed for any of the artworks on the panel. Our genomers are masters of efficiency, and over the years we have worked closely with them to tailor a dynamic interface to their specific workflow. When we started working on the app, the back-end was organized, modular, and interfaced seamlessly with the Artsy API, but there were still a few front-end features we needed to implement before it could be used by the Genome Team. Choosing a Suitable Framework We decided to introduce a front-end framework to make it easier to add new features, and spent a day researching different options. Our plan was to eventually replace all of the existing *.haml.erb templates and global CoffeeScript mixins with discrete React components.

React.js resources It has been some time (almost 2 years?) since we started using React.js at Arkency. It quickly propagated to all of our projects. Along the way, we’ve been blogging a lot about what we learnt. So far we’ve released: 28 blogposts5 open repositoriesReact.js koans7 YT videos2 books (with repos)dozens of emails to our React Kung Fu mailing list This blogpost is an attempt to put all the resources in one place. Rails meets React.js The book will teach you: How to install and configure React.js in your Rails project.Working with dynamic React based forms.How to transform your view to React-managed components.What you can use React.js for in your projects and how.Detailed knowledge about how to use it and best practices to work with React.js, with examples.How to test React components.You will also get Ruby and CoffeeScript code for the examples.And it begins with a tutorial so that you start with practical skills. Buy Rails meets React.js React.js by example

React vs Angular 2 - final Tutorial: Setting Up a Simple Isomorphic React app Note: this tutorial assumes React 0.13 and React-Router 0.13. Updates coming soon for the new versions After hearing the responses of one of my other tutorials, it quickly became evident that a quick Google search on "setting up React" led to very confusing results. The project is on Github, and the following is a quick walkthrough of how to start from scratch. The goal of this project/tutorial to not only get someone's projected started but to clarify the process behind an isomorphic app. Isomorphism The main idea behind an isomrophic app is that instead of bundling all your React code into a single bundle (and then using something like <script src="bundle.js"> in a bare bones html page), you run a Node.js server that serves the files for you. With that, I will bring you through the entire set up process. Tutorial The tutorial will use the following stack: Installation Make sure that at least Node 0.12 is installed (check out nvm if you have questions on that). Jade view Webpack Dev Server

How to Structure a React Project? – ReactJS News Editor’s Note: Please check out the React Indie Bundle. Juho and many other members of the React community help put it together. All of the proceeds go towards awesome people in our community. Programming is a bit like gardening. There are multiple ways to structure your project. Everything in One File The simplest of projects can fit into a single file. You could start working on a React project in a similar manner. Multiple Files The obvious way to solve this problem is to start splitting things up. app $ tree . ├── components │ ├── App.jsx │ └── Note.jsx ├── index.jsx └── main.css Here index.jsx works as the entry point of the application. If you wanted to test your components, you would add a separate directory for tests and develop them there. You can get quite far with this basic structure. Components in Their Own Directories This problem can be solved by adding more structure the system. Adding Views to the Mix This is likely where opinions begin to diverge. Dealing with Data Concerns

9 things every React.js beginner should know - Cam Jackson I've been using React.js for about 6 months now. In the grand scheme of things that's not very long at all, but in the ever-churning world of JavaScript frameworks, that just about qualifies you as a bearded elder! I've helped out a few people lately with React starter tips, so I thought it would be a good idea to write some of them up here to share more broadly. I'm going to assume that you know the absolute basics; if the words component, props, or state are unfamiliar to you, then you might want to read the official Getting started or Tutorial pages. 1. Let's get the basics out of the way. 2. This might seem like an obvious one, but it's worth calling out. const LatestPostsComponent = props => ( <section><div><h1>Latest posts</h1></div><div> { props.posts.map(post =><PostPreview key={post.slug} post={post}/>) } </div></section> ); The component itself is a <section>, with only 2 <div>s inside it. 3. ... and the other being ES6 classes: This class isn't too bad, as far as classes go.

Learn React By Itself -- no JSX, no Flux, no ES6, no Webpack. Disclaimer: I love JSX, Flux, ES6 and Webpack. I’ll discuss these tools more in another series. So you’ve heard all the fuss about React.js – apparently it is the best thing since XMLHttpRequest. But you’ve spent a couple hours investigating, only to find so many buzzwords that it just feels overwhelming. Luckily for you, that’s exactly what this series will do! Exercise 1 – Write a single-file React.js app Have you worked with JavaScript, CSS and HTML before? The result of this exercise is a single HTML file, which contains your first React app. Step 1 Copy this HTML into a new file and save it somewhere: <! This HTML file does two important things – it creates the div where your rendered content will live (with id react-app), and it loads the two library files where React lives. With that done, let’s move on to: Step 2 Type this script into a new <script> tag at the end of your HTML file. Why type it out instead of copy and paste? Phew, that was a bit of work, wasn’t it? Step 3 Got it? Neat.

React.js Conf 2016 Quick Summaries — Day 1, Part 1 Rich Text Editing with React Isaac Salier-Hellendag (Facebook) The below technology has been open-sourced by Facebook! Plain text is boring. At Facebook, we want to give our users the ability to add mentions, emoticons, hashtags, styles, and embedded media within the content they share. As UI engineers, we want to provide our product teams with the tools to implement and expand upon these features without pushing them into the contentEditable pit of despair. This talk will dive into the details of how we used React, ImmutableJS, and yes, contentEditable, to create an editor framework that enables engineers to build and customize rich text composition experiences across Facebook. Anatomy of a Facebook input, consists of text, mentions, hashtags, all highlighted, all different data ContentEditable, the good parts @Mentions example

Related: