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”

Unveiling Ignite 2 – Red Shift

“Unveiling Ignite 2” by @GantLaborde  #React #Native #Boilerplate #Beginner #JavaScript

  • Unveiling Ignite 2Your Co-Pilot for Building React Native AppsWe’re excited to announce the release of Ignite 2 beta!
  • Over the past six months the Ignite team has been working hard to revamp Ignite into something even better.Why?We have teams of various sizes and we want this experience:Bob: Hey, can you add maps to my React Native project for me?Alice: Here ya go, and here’s an example map with some notes in comments.Bob: Thanks!
  • That’s exactly what I needed.We’re developers, by the third time we’ve helped someone add X to their project, we knew we had to do something better.What was Ignite 1.0?
  • Ignite 1.0 was a resounding success of examples jammed into one app.
  • People want to easily remove a few things to make room for their own opinions.Starting project-friendly practices framework is great, but as the app develops the two inevitably grow apart.Not every opinion can fit in a single project.

We’re excited to announce the release of Ignite 2 beta! Over the past six months the Ignite team has been working hard to revamp Ignite into something even better. We’re developers, by the third time…
Continue reading “Unveiling Ignite 2 – Red Shift”