Rendering a function with React – kentcdodds

  • But there are reasons for the API as it is and that’s not what we’re going over in this newsletter…With ReactSo thinking about this in the context of React:const getHomeContent = getContent(‘pages.home’)const ui = ( a href=”/about” {getHomeContent(‘nav.about’)} /a)// that’ll get you:a href=”/about”About/aSo far so good.
  • Anyway, this will break the app:const getHomeContent = getContent(‘pages.typo’)const ui = ( a href=”/about” {getHomeContent(‘nav.about’)} /a)// 💥 error 💥Again, this is happening because getContent(‘pages.typo’) will return the string {pages.typo} (to indicate that there’s no content at that path and the developer needs to fix that problem to get the content)….
  • The issue is that you can’t invoke a string but that’s what’s happening because getHomeContent is a string, not a function.A solution and a new problemSo the change I made this week makes it so when there’s no content at a given path, instead of a string, it returns a “sorta-curried”…
  • No problem.So now this wont throw an error, but we lose rendering the path if there’s no content!const getHomeContent = getContent(‘pages.typo’)const ui = ( a href=”/about” {getHomeContent(‘nav.about’)} /a)// that’ll get you:a href=”/about”/aAnd we want to make sure that we show the missing content so it’s more obvious for developers (yes…
  • Let’s rewrite the above to make this more clear:const getHomeContent = getContent(‘pages.typo’)const aboutContent = ui = a in this example is a function because the call to getContent had a typo, so we’ll never actually find content that matches the full path.

NOTE: This is a cross-post from my newsletter. I publish each email two weeks after it’s sent. Subscribe to get more content like this earlier right in your inbox! 💌 This week I was working on an…
Continue reading “Rendering a function with React – kentcdodds”

Improving the usability of your modules – kentcdodds

Improving the usability of your modules  #reactjs

  • All you have to do is use it:import getContentForFile from ‘react-i18n’const i18n = App() { return ( div h1{i18n(‘header.title’)}/h1 /div )}So that’s how it works (again, I’m sure some of you are thinking of other libs that could do this better, but please spare me the “well actually.” I’m aware…
  • const content = JSON.parse( … more stuffexport {getContentForFile as default, init}This presents a few challenges for users of the module.
  • Turns out that react-i18n actually exposed another module react-i18n/bootstrap to customize this behavior which is great, but that doesn’t resolve the problem of stuff happening if someone were to import react-i18n first.So what I did was a wrapped all side-effects in a function I exported called init(which was similar to…
  • But it’s ok now because that’s clear const messages = JSON.parse( ) // … other other stuff}// … more stuffexport {getContentForFile as default, init}So this means that anyone using the module now must call the init function, but they’re doing that on their own terms and whenever they want it…
  • However, we’re in the process of “inner sourcing” this module (and perhaps open sourcing it eventually), so folks are going to use it who use different tools and have different use cases.So, if it’s not too much work and doesn’t add too much complexity, then try to make the solution…

NOTE: This is a cross-post from my newsletter. I publish each email two weeks after it’s sent. Subscribe to get more content like this earlier right in your inbox! 💌 This last week I worked on my…
Continue reading “Improving the usability of your modules – kentcdodds”

Issue 9: React 16 🎉 – React Native Coach

Issue 9: React 16  #iosappdevelopment #androidappdevelopment #javascript #reactjs

  • The full meeting notes are available here.GeekyAnts announced their React Native design tool BuilderX at React Europe and launched React Native Seed, boilerplates for your next React Native project.Facebook is actively working on improvements to Text and TextInputcomponents on Android.Microsoft released code signing for CodePush.
  • Full details are available here.Around the WebGreat addition to this series on Major League Soccer’s path to universal components in React Native from kurtiskemple.Mapbox began supporting an experimental React Native component this week and you can get all the details here.
  • 🗺Get your next project started fast with GeekyAnt’s cool new tool which generates boilerplates for React Native projects including most common dependencies.
  • From Sanket Sahu.Alex Grigoryan announces Walmart Lab’s latest platform Electrode Native which aims to reduce the difficulty for developers who want to build and reuse React Native components across multiple apps.Awesome post and demo from Karim Maaloul on WebGL interaction and animation techniques.SponsoredGet your next React Native project up and…
  • 👏🏻ReactReact 16React 16 was released this week and there’s a lot of exciting updates that should improve our workflows and the performance of our React Native apps.

React 16 was released this week with a host of other frameworks having updates as a result. We’ll be taking a look at one of those in this issue but I would check your dependencies for updates. If…
Continue reading “Issue 9: React 16 🎉 – React Native Coach”

React stickers stickers

Check out our React JS #stickers

  • High quality, weather resistant and durable stickers to give your case the identity it deserves.
  • Your stickers are printed from a sheet vinyl, covered by a layer of top quality transparent film to protect the ink and improve durability and beauty, then finely cut to follow the shape.

Ultimate quality, top notch printing process, unique design React stickers stickers at Unixstickers, the largest unix, programming and software SWAG store. Free shipping available.
Continue reading “React stickers stickers”

Axosoft Dev Talk: React and Redux

Our latest #DevTalk is on one-way dataflow with @reactjs and #redux:

  • In this talk, GitKraken developer Tyler Wanek discusses React and Redux, and their uses for one-way dataflow.
  • Tyler will be using the following repo as an example:

In this talk, GitKraken developer Tyler Wanek discusses React and Redux, and their uses for one-way data flow. Watch this 3 part video series!
Continue reading “Axosoft Dev Talk: React and Redux”

Setup React Native for iOS and Android

Setup React Native for iOS and Android

  • Your link to unlock this lesson will be sent to this email address.
  • We’ll also setup Android, Android Studio and get the project running on an emulator with the react-native run-android command.
  • Unlock this lesson and all 827 of the free egghead.io lessons, plus get React content delivered directly to your inbox!
  • In the lesson we’ll walk through the process of installing the react-native-cli through setting up a basic react-native project on iOS. We’ll get the basic project running in a simulator via XCode.
  • Member comments are a way for PRO Members to communicate, interact, and ask questions about a lesson.

In this lesson we’ll walk through the process of installing the react-native-cli through setting up a basic react-native project on iOS. We’ll get the basic project running in a simulator via XCode. We’ll also setup Android, Android Studio and get the project running on an emulator with the react-native run-android command.
Continue reading “Setup React Native for iOS and Android”

Get the Dimensions of a React Native Phone Screen

Get the dimensions of a #ReactJS Native phone screen:

  • Your link to unlock this lesson will be sent to this email address.
  • In the lesson we’ll use Dimensions to get the width and height of the screen.
  • Member comments are a way for PRO Members to communicate, interact, and ask questions about a lesson.
  • 1:10 React lesson by Jason Brown
  • Unlock this lesson and all 704 of the free egghead.io lessons, plus get React content delivered directly to your inbox!

In this lesson we’ll use Dimensions to get the width and height of the screen. Also we’ll use onLayout to detect orientation changes.
Continue reading “Get the Dimensions of a React Native Phone Screen”