Skip to content

Only static array with number values is allowed #9

Description

@kostyasu5

Hello!
Firstly, i want to say, that your project is very weell.

I have some problems with img component and next-optimized-images. I want to create specific component, whic return img component from 'react-optimized-image'.
`
import Img from 'react-optimized-image';

const Image = ({src, ...rest}) => {
сonst sizes = [100, 200, 300];

return (
	<Img
		src={require(`Public/images/${src}`)}
		webp
		densities={[1, 2]}
		breakpoints={[480, 576, 768, 992, 1200, 1600]}
		sizes={sizes}
		{...rest}
	/>
);
};

export default Image;

`

When i run "npm dev", there is syntax error in console - "Only static array with number values is allowed". https://i.imgur.com/ZpTgGqu.png
Can you help me, please?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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