question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Image is not working as expected

See original GitHub issue

🐛 Bug report

While using the Image component this is what I get.

Unhandled Runtime Error

Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.

This is the code snippet

import {Box, Center, Flex, HStack, Image as Img} from '@chakra-ui/react';

I don’t know if I am making a stupid mistake or if this is a real issue

<Box w={100}> <Img src="https://via.placeholder.com/200x60" />   </Box>

🌍 System information

Software Version(s)
Chakra UI 1.0.3
Browser Mozilla
Operating System Windows 10

📝 Additional information

Unhandled Runtime Error

Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

11reactions
segunadebayocommented, Dec 17, 2020

Hi @quarterpound, I’d recommend switching the Image component to Img from @chakra-ui/react when using Next.js

import { Img } from "@chakra-ui/react"
0reactions
quarterpoundcommented, Dec 18, 2020

That was the problem thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

7 Reasons Why Images Are Not Loading on Your Website
7 Reasons Why Images Are Not Loading on Your Website · 1. Incorrect File Paths · 2. Files Names Misspelled · 3. Wrong...
Read more >
CSS background image is not working as expected
For some reason image background set via background is not working. Developer tools in both Chrome and Firefox are showing that the image...
Read more >
How to handle loading of images that may not exist?
How to handle loading of images that may not exist? · 1. Periodic data cleanup · 2. Handle it in your application ·...
Read more >
Improving the Image Loading Experience
Over time several techniques have been established to help improve how images load on a page, both for speed and to improve the...
Read more >
How to fix CSS background-image not working | HTML/CSS
If the image isn't showing up, but you aren't getting any 404 errors, go into the code inspector and check the element itself....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found