Building Size-Aware React Components – LogRocket

Building Size-Aware #ReactJS Components:  by @b_edelstein #JavaScript

  • When using an HTML5 Canvas that has to be re-drawn whenever its size changesWhen building a layout where the user can adjust the sizes of different panesWhen using elements or 3rd party libraries that require a known size like react-virtualized, fixed-data-table, etc.When rendering elements with absolute positioning that need their position adjusted when the container size changes.When animating an element’s size with CSS with additional logic that depends on this animated sizeSome of these behaviors may be achievable with CSS, or by managing window size with the onResize event, but in the interest of building React components that are maximally reusable, it makes sense to encapsulate this logic into the component itself.
  • This method is called whenever the component’s size or position changes, and can be used to trigger side effects or put the dimensions into state.This solves most of the earlier examples but there’s one issue — a chicken and egg problem.
  • As such, we don’t always know the dimensions in the render function, so it’s not entirely possible for the component to have render logic based on its dimensions.react-sizemeTo solve this problem, we turn to a library called react-sizeme.
  • This library is similar to react-measure but uses a clever solution to solve the aforementioned problem.react-sizeme does an initial, invisible render of the component to measure its size.
  • Usually this feels quite fast, but in practice, I’ve noticed a slight delay in detecting changes which can lead to a component feeling slow.In general, react-measure has less of a performance impact, so it should be used if possible, but in cases where a component’s initial render depends on its size, then react-sizeme is a good option.Resources

When building React apps, it is sometimes advantageous for components to have awareness of their size and position on screen. This is useful both for rendering content initially, but also for…
Continue reading “Building Size-Aware React Components – LogRocket”

Codecademy Launches Free ReactJS Courses – WordPress Tavern

Codecademy Launches Free ReactJS Courses #wordpress #wp #themes

  • Codecademy Launches Free ReactJS Courses
  • Sorry, your blog cannot share posts by email.
  • In August 2014, the learning environment at Codecademy was overhauled to use React.js and members have been asking for a React course since that time.
  • Learn ReactJS: Parts I and II teach students how to build React applications in 11 hours time.
  • The courses already have more than 100,000 students enrolled and are likely to become popular additions to Codecademy’s catalog, as React’s popularity is currently soaring past all other front-end frameworks.

Codecademy, the free interactive coding education site, has launched a new ReactJS course. For the past five years, the site’s free, self-guided courses have attracted more than 25 million students. Codecademy recently partnered with the White House as part of the TechHire initiative to promote more diverse entrepreneurship in the tech industry through coding education. The site’s catalog includes basic courses like HTML and CSS fundamentals and programming language courses for JavaScript, Ruby, Python, and PHP.
Continue reading “Codecademy Launches Free ReactJS Courses – WordPress Tavern”

Declarative routes with GraphQL and Relay · Issue #736 · kriasoft/react-starter-kit · GitHub

Declarative routes with #GraphQL and Relay:  #ReactJS

  • }], queries : { viewer : () => Relay.QL ` query { viewer } ` , tasks : () => Relay.QL ` query { task( id: $id ) } ` }, component : ‘ .
  • But if you’re using Relay in your project, declarative routes might also be a good option.
  • So that when you reference the routes.json file in your code (e.g. import routes from ‘.
  • RSK is currently using imperative (or, functional) routes.
  • By using a simple loader for Webpack (see routes-loader.js ) you can transform such routes into JavaScript during compilation by using wonderful path-to-regexp library.

Read the full article, click here.


@ReactiveConf: “Declarative routes with #GraphQL and Relay: #ReactJS”


react-starter-kit – React Starter Kit — isomorphic web app boilerplate (Node.js, Express, GraphQL, React.js, Babel 6, PostCSS, Webpack, Browsersync)


Declarative routes with GraphQL and Relay · Issue #736 · kriasoft/react-starter-kit · GitHub