⚛️ 🚀 Introducing React-Static — A progressive static-site framework for React!

  • How well that static site performs and how easily you can build that site is another story.ProsVery easy to get startedWell documentedConsSubpar developer experience for static functionality no hot-reloadingLarge per-page JS bundles, resulting in a lot of unnecessary duplicate code being downloaded.Difficult root component customizationDestructive routing.
  • We also knew that we needed to ditch built-in proprietary connectors ASAP; being able to get your data from anywhere is important, but the ability to use and access that data in your site is paramount.Most importantly, we needed a tool that would allow us to build things like an…
  • It’s insanely fast, touts fantastic SEO capabilities, and is probably the most React-friendly static-site library on the internet.Let’s get to it.How does it work?react-static starts by exporting a single JS bundle, which includes every template for your entire site.
  • To connect a component to this data, you use a convenient HOC called getRouteProps.The HTML files generated by react-static ensure that pages load instantly and are optimized for SEO.Once the page is loaded, your site invisibly and instantly transitions to your react app.At this point, navigating around your app will…
  • You’ve worked hard enough producing and organizing all of the data for your website, so the last thing you need is some superfluous GraphQL layer or custom component lifecycle lodging itself between your data and your pages.

At Nozzle.io, we take SEO, site performance, and user/developer experience very seriously. Over the last year, we’ve launched many sites using different static site tools that claim to solve these…
Continue reading “⚛️ 🚀 Introducing React-Static — A progressive static-site framework for React!”

Where to Fetch Data: componentWillMount vs componentDidMount

Where to Fetch Data: componentWillMount vs componentDidMount  #ReactJS #JavaScript

  • There are two common places to fetch data:

    And just so we’re clear, the function is never a good place to fetch data – or to do anything that’s asynchronous, that changes state in some way, or that causes side effects.

  • This function is called right before the component’s first render, so at first glance it appears to be a perfect place to put data fetching logic.
  • This means the component will render with empty data at least once.
  • In practice, is the best place to put calls to fetch data, for two reasons:

    Using DidMount makes it clear that data won’t be loaded until after the initial render.

  • If you’re still not sure of the best way how to actually make the AJAX call and load data, read my post AJAX Requests in React.

When you need to fetch some data for a React component, where do you do it?
Continue reading “Where to Fetch Data: componentWillMount vs componentDidMount”

How extensively/deeply do you validate props in React?

Do you validate props in your #ReactJS components? 🕵 How deeply?  #JavaScript #WebDev

  • Also setting isRequired on a component’s props is a valuable way of declaring mandatory props.
  • I then later realised the value in doing so because if you are a fresh pair of eyes on somebody else’s code, and looking at the props on a component that you are changing, at a glance you will see the required data types and structure for that component, even if that component is 3/4 layers deep.
  • To reduce the repetitive validation checks, when same props are being passed down around to multiple components, I create modules for prop interfaces and import that in individual components.
  • /IFormTheme’ class SomeFormControl extends Components { static propTypes = { theme: IFormTheme } …
  • At my company we do it the whole way down, I initially started doing this when my company’s EsLint config required it (you will get errors when linting etc.).

Do you even validate the internal structure of your props, or do you just validate at the top level?. Tagged with React Native,ReactJS.
Continue reading “How extensively/deeply do you validate props in React?”

React; The Learning Curve — Medium

Going reactive with #reactjs, the learning curve, good hoy by @philip_nunoo ⚗ ♨️ #react

  • And given the project to someone who doesn’t know a lot about react components, mmmm, I don’t know how the person would handle it.
  • And I was like “eerrrrrr, so the way react encourages the use of components, I’m not really sure, the only thing you’d get is a JSX file.”
  • With blaze I’d need an Html file, declare my template in there, and have a separate js file with my Js in there.
  • The first problem I encountered after I wrote my first React component was I could not use ‘class’ attribute inside my html tag.
  • Breaking UI into a component hierarchy has a lot good, as it helps in the way I conceptualize my webapps and future application.

Read the full article, click here.

@OpenCoconut: “Going reactive with #reactjs, the learning curve, good hoy by @philip_nunoo ⚗ ♨️ #react”

After working with Meteor for the past 2 years. And MDG announcing support for npm packages and react getting a lot of noise, I knew the…

React; The Learning Curve — Medium