Step by step guide for writing awesome React components

  • Now imagine the most verbose way to write it.class SlothImage extends React.Component { render() { return img src=’sloth.gif’ alt=’Pretty face’ }}export default SlothImageThis code is completely correct and performant but can it be shorter?
  • This component has no use of lifecycle methods.const SlothImage = props = { return img src=’sloth.gif’ alt=’Pretty face’}export default SlothImageTwo lines have been spared by converting the class component to the functional component.
  • /*The props should now be built like this:{ src: ‘sloth.gif’, alt: ‘Pretty face’,}*/export default props = img {…props}The dots are called a spread operator (❧).
  • My personal taste for writing more complex components is as follows:export default ({ separateNext: underline, rightComponent, onRightComponentClick, …rest: imgProps}) = { return ( Row underline SlothImage {…imgProps} / /Row )}If I could pick one rule in writing React components it would be exceeding the 80 characters mark (❧) in a…
  • The sign of overcomplication is the usage of “enum” like props or having too many props.TextInput required width=’col-6′ height=’xlarge’ bgColor=’#a4a4a4′ type=’primary’ suffix=’dollar’ 1337/TextInputEvery component should have a single responsibility (❧) and a reasonable amount of flexibility.

Going through the process of learning and using React and Redux I came to a following conclusion – they are not hard to grasp but are fairly difficult to master. Both are pretty minimal when it comes…
Continue reading “Step by step guide for writing awesome React components”

BREAKING: Next.js 3.0 is out via @zeithq @rauchg @arunoda #javascript #framework #reactjs

  • Next.js is a zero-configuration, single-command toolchain for React apps, with built-in server-rendering, code-splitting and more.
  • The prolific Next.js community has already come up with some static blog generators for you to check out:

    With dynamic imports, our codebase gets split into a set of chunks that can later be loaded dynamically.

  • The developer gets full control to load code over time, depending on user interaction or the data itself.
  • Dynamic components can load React code on-demand, but the most interesting feature is that if they are included in the initial rendering, server-rendering still works!
  • Moving forward, you’ll be able to load code as a function of the data the user is presented with.

Next.js 3.0 comes with vastly improved HMR, dynamic imports, static exports and better serverless support!
Continue reading “BREAKING: Next.js 3.0 is out via @zeithq @rauchg @arunoda #javascript #framework #reactjs”

Getting Started with React.js

Getting Started with React.js -  #javascript #webdev #reactjs

  • The big advantage of JSX is that it lets you include HTML in your JavaScript files it makes defining React elements easier.
  • A component can be made of one or many React elements.
  • A React component is built up of some or many React elements that are the smallest units of React apps .
  • Tags that start with uppercase (upper camel case) are rendered as React components .
  • It’s recommended using React with Babel that allows you to use the ECMAScript6 syntax and JSX in your React code.

React.js is a flexible and component-based JavaScript library for building interactive user interfaces. It was created and open-sourced by Facebook and is used
Continue reading “Getting Started with React.js”

How to build an SEO friendly website with React — BluedgeLtd

Build an SEO friendly website with #ReactJS:

  • It requires the basic React modules and also our next file to create the app.js file where we will put the code for our React app.
  • We require ‘ babel-core ‘ module so we can compile React code (note the presets parameter : ‘ react ‘).
  • Alternatively you can use ‘ npm run build ‘ as we have this line of code in the package.json file
  • Making 2 different files will also help while rendering the file on the server site as we will work directly with the app.js file
  • // REACT (for SEO) var React = require(‘react’); var ReactDOMServer = require(‘react-dom/server’);

Read the full article, click here.


@ReactiveConf: “Build an SEO friendly website with #ReactJS:”


When I first started to (re) code this Web App (www.clean-url.cool) with ReactJs I was very excited to structure the code the React way and…


How to build an SEO friendly website with React — BluedgeLtd

Using JSX and React

Using #JSX and #ReactJS @tutsplus  #JavaScript #webdev #tutorial #developer #frontend

  • The gap between mocking up wireframes of semantically formed ideas and implementing them has never been closer.
  • ChatServer.prototype.connect = function (username) { var self = this; this.setUsername(username); this.socket = io(); this.socket.on(‘connect’, function () { self.socket.on(events.CONNECT, function (userId) { if (userId === self.getUsername()) { return; } self._connectTo(userId); self.emit(events.CONNECT, userId); console.log(‘User connected’, userId); });
  • JSX is similar to a mix of XML and HTML. You use JSX within React code to easily create components for your apps.
  • Heroku also creates a git repo for this app.
  • We will start the app from the ground up to give you a good feel of how to create a React application.

Read the full article, click here.


@DBaker007: “Using #JSX and #ReactJS @tutsplus #JavaScript #webdev #tutorial #developer #frontend”


What You’ll Be CreatingJSX is similar to a mix of XML and HTML. You use JSX within React code to easily create components for your apps. JSX transforms into JavaScri


Using JSX and React

React Native Flat App Theme — NativeBase.io Blog

React Native Flat App Theme captivating #UX for #MobileApps

  • React Native Flat App Theme
  • As React Native uses native views, gives platform-specific look and feel on Android & iOS similar to native apps.
  • We’re excited to announce the launch of our new theme, React Native Flat App Theme , a fascinating React Native starter kit with flat UI design, Redux and NativeBase components for iOS and Android application.
  • React Native apps use special XCode / Android container.
  • Our open source framework helps to write high-quality React Native apps providing generic re-usable set of components.

Read the full article, click here.


@Roger_M_Taylor: “React Native Flat App Theme captivating #UX for #MobileApps”


We’re excited to announce the launch of our new theme, React Native Flat App Theme, a fascinating React Native starter kit with flat UI…


React Native Flat App Theme — NativeBase.io Blog

Using Native SDKs and Libraries in React Native

Using native SDKs and libraries with #React Native

  • Most of the time, these are only available in their native version, and only accessible as Objective-C or Swift libraries in the case of iOS apps or as Java Classes for Android apps.
  • Step 2: Call our bridge from our React Native code.
  • Step 1: Create two native files for our bridge.
  • An Objective-C class is made out of two files, a .m and a .h, holding the module implementation and the header for this module respectively.
  • When building an app in React Native we may end up needing to use third-party SDKs or libraries.

Read the full article, click here.


@PacktPub: “Using native SDKs and libraries with #React Native”


Using Native SDKs and Libraries in React Native written by Emilio Rodriguez: one of the many blog articles from Packt Publishing


Using Native SDKs and Libraries in React Native