Skip to content

image map require error #191

@Hazantip

Description

@Hazantip

Node version:
6.2.2
npm version:
3.9.0
Operating system:
win10
Command line used:
npm run start
Steps to reproduce:
map list with images. probplem with image src={require(image)}

const images = props.postcardImages.map((image, i) => { return ( <li className="postcards-list-item" onClick={() => {props.setPostcardActiveImage(image);}} key={image + i}> <Link to="/postcard-edit"> <img src={require(image)} alt=""/> </Link> </li> ); });
image - string with image path. if i put just string(not variable) it works fine, but i need to map it. when i try to do this staff i get the error:
Uncaught Error: Cannot find module '../images/postcard.jpg'.(anonymous function) @ Uncaught TypeError: Cannot read property '__reactInternalInstance$f26nyhc5w3kdfida23zph9f6r' of null

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions