1

So I am currently developing a web application and noticed that some of my components renders twice and I am not really sure why and also that console.log appears twice in the console. I am sure that I am only calling the console.log once and the toast once.

enter image description here

enter image description here

I have read about the strict mode in reactjs but I am unsure if it is enabled or not since I can't find it in my source code.

Here's my app.jsx

import '../css/bootstrap/bootstrap.min.css';
import '../css/bootstrap-icons-1.10.3/bootstrap-icons.css'
import '../css/dhca-base.sass'

import React from 'react';
import { createInertiaApp } from '@inertiajs/react'
import { createRoot } from 'react-dom/client'

const appName = window.document.getElementsByTagName('title')[0]?.innerText || 'Laravel';

createInertiaApp({
    title: (title) => `${title} - ${appName}`,

    resolve: name => {
        const pages = import.meta.glob('./Pages/**/*.jsx', { eager: true })
        return pages[`./Pages/${name}.jsx`]
    },
    setup({ el, App, props }) {
        createRoot(el).render(<App {...props} />)
    },
})

I also have the reactjs development extensions in my browser and it shows me a warning sign near the Inertia title. enter image description here

Jheems
  • 300
  • 1
  • 4
  • 11

1 Answers1

0

Turns out everything is set up correctly and I was just not using the useEffect hook correctly.

Jheems
  • 300
  • 1
  • 4
  • 11