DailyJS
Published in

DailyJS

Image from Canva

Conditional rendering in React Native may crash your app

any expressions

How logical AND && operator in JavaScript works?

[…] If a value can be converted to true, the value is so-called . If a value can be converted to false, the value is so-called .

Examples of expressions that can be converted to false are:

null;

NaN;

0;

empty string ("" or '' or ``);

undefined.

— MDN docs: Logical operators

String variable.

Numeric variable.

Other variable types worth mentioning.

Why React Native crashes?

What about a numeric variable?

Why is it hard to find React Native conditional render error?

React for web — zero appears

How to make conditional rendering safer?

Double negation — !!dangerousData

Classic conversion — Boolean(dangerousData)

Rethink components architecture.

Explaining the array example (from the introduction)

--

--

--

JavaScript news and opinion.

Recommended from Medium

Writing Cleaner Code With JavaScript Array Methods

Let’s Create a Cryptocurrency for Fun using JavaScript

JavaScript Advanced Concepts

Bye Gatsby (Episode 2)

Fetch a query only once until page refresh using React Query

Lazy Loading with React + Redux and Webpack 2

How to build a flip timer in React Native

‘Event’ Project & JQuery

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Daniel Koprowski

Daniel Koprowski

Senior Frontend Developer. Enthusiast of React and TypeScript. Writing about programming, productivity and hobbies.

More from Medium

Sharing code between ReactJS and React Native using Nx.

This Week In React #94: 2 years 🥳️, memoization, composition, Remix, Next.js,

Rewriting ReactNative in Typescript

Using React Native TypeScript and Redux