# babel-plugin-convert-react-type-comparison

> React Hot Loader patches REACT on the fly to make createElement creates an instance of a proxified REACT class, enhanced with hotloading capabilities. As a side effect, this kind of code will allways return false :

Latest version **1.0.0** (published 2018-04-11) · 0 weekly downloads

## Install

```sh
npm install babel-plugin-convert-react-type-comparison
pnpm add babel-plugin-convert-react-type-comparison
yarn add babel-plugin-convert-react-type-comparison
bun add babel-plugin-convert-react-type-comparison
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-04-11 |
| First published | 2018-04-11 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | dntrkv |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-convert-react-type-comparison
- npm.io page: https://npm.io/package/babel-plugin-convert-react-type-comparison

## Recent versions

- 1.0.0 (latest) — 2018-04-11

## README

React Hot Loader patches REACT on the fly to make createElement creates an instance of a proxified REACT class, enhanced with hotloading capabilities.
As a side effect, this kind of code will allways return false :

var foo = <MyComponent />
return foo.type === MyComponent

because foo is based on a proxi of MyComponent class.
Bytheway, in production, this code will return true.

To make the comparison works in dev mode, a solution is to compare the type of the element to the type of a newly created componnent, and not the base class :
return foo.type === (<MyComponent>).type
will work

That's the purpose of this babel plugin. It replaces every expression like { foo.type === MyComponent } by { foo.type === (<MyComponent>).type }

---
_Source: https://npm.io/package/babel-plugin-convert-react-type-comparison · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
