Animation JSON file does not import from direct public

Viewed 11

I need help...

I imported an animation in JSON format (from After Effects) into a ReactJs project. (I'm using nextJs and lottie) but the animation doesn't run when I import it in the public folder, but if I put it in src it runs, but it's only available at runtime (local).

Does anyone know what could be happening?

import { Box, Button, Typography } from '@material-ui/core';

import Lottie from 'lottie-react';

import lotusCarAnimation from '/static/lotuserro404.json';

const ServiceNotFoundState = () => {
    return (
        <Box m={3}>
            <Box display="flex" alignItems="center" flexDirection="column">
                <Box m={2}>
                    <Lottie animationData={lotusCarAnimation} loop={false} />
                </Box>
                <Box m={2}>
                    <Typography variant="h3">Esse serviço não existe!</Typography>
                </Box>
                <Box m={4}>
                    <Button disableElevation variant="contained">
                        Voltar
                    </Button>
                </Box>
            </Box>
        </Box>
    );
};

import { Box, Button, Typography } from '@material-ui/core';

import Lottie from 'lottie-react';

import lotusCarAnimation from '/static/lotuserro404.json';

const ServiceNotFoundState = () => {
    return (
        <Box m={3}>
            <Box display="flex" alignItems="center" flexDirection="column">
                <Box m={2}>
                    <Lottie animationData={lotusCarAnimation} loop={false} />
                </Box>
                <Box m={2}>
                    <Typography variant="h3">Esse serviço não existe!</Typography>
                </Box>
                <Box m={4}>
                    <Button disableElevation variant="contained">
                        Voltar
                    </Button>
                </Box>
            </Box>
        </Box>
    );
};

export default ServiceNotFoundState;

0 Answers
Related