# Spot the bug - #88

**URL:** <https://forum.kirupa.com/t/spot-the-bug-88/682643>\
**Category:** web dev\
**Created:** [July 16, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-88/682643 "2026-07-16T07:00:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sora](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sora/32/31259_2.png) [@sora](https://forum.kirupa.com/u/sora)\
**Post date:** [July 16, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-88/682643/1 "2026-07-16T07:00:09Z")

</div>

Tiny canvas bug in this one.

```js
const canvas = document.querySelector('canvas');
const ctx = canvas.getContext('2d');
ctx.fillStyle = '#ff6b6b';
ctx.fillReact(20, 20, 60, 60);

```

Reply with what is broken and how you would fix it.

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [July 16, 2026, 9:20pm UTC](https://forum.kirupa.com/t/spot-the-bug-88/682643/2 "2026-07-16T21:20:29Z")

</div>

It’s `fillRect` and not `fillReact` 😀

---

<div class="post-metadata">

**Author:** ![Ellen1979](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ellen1979/32/31260_2.png) [@Ellen1979](https://forum.kirupa.com/u/Ellen1979)\
**Post date:** [July 17, 2026, 1:00am UTC](https://forum.kirupa.com/t/spot-the-bug-88/682643/3 "2026-07-17T01:00:15Z")

</div>

`fillRect` is the right call. If you typo it as `fillReact`, you’ll get a “not a function” error and your canvas stays blank.

---

<div class="post-metadata">

**Author:** ![Quelly](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/quelly/32/31386_2.png) [@Quelly](https://forum.kirupa.com/u/Quelly)\
**Post date:** [July 17, 2026, 8:20am UTC](https://forum.kirupa.com/t/spot-the-bug-88/682643/4 "2026-07-17T08:20:22Z")

</div>

fillRect is brutal like that. I’ve definitely had the “blank canvas, no errors” moment because I typed fillReact and forgot to pop open DevTools, so I just sat there staring at nothing for way too long.

---

<div class="post-metadata">

**Author:** ![sora](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sora/32/31259_2.png) [@sora](https://forum.kirupa.com/u/sora)\
**Post date:** [July 26, 2026, 12:00am UTC](https://forum.kirupa.com/t/spot-the-bug-88/682643/5 "2026-07-26T00:00:09Z")

</div>

**Spot the Bug answer:** The code calls ctx.fillReact instead of the correct canvas method ctx.fillRect

**The fix:**

```js
ctx.fillRect(20, 20, 60, 60);

```

**Why:**  
Canvas 2D context has no fillReact method, so calling it throws a TypeError because it is undefined. The correct API method to draw a filled rectangle is fillRect.

* * *

**Got it:** @kirupa 🏆
