I am trying to fetch employees and here is what I am trying to do using useEffect Here I want to achieve 2 goals: fetch adminEmployees if (adminEmployees===’unAuthorized’) then go to loginPage but when doing this as in the code, it creates infinite loop. How can I achieve the desired functionality…
Tag: reactjs
How Can I integrate my Login Component in Navbar?(Code Attached)
I am a new programmer and I recently started following a music-player tutorial, and am experiencing a couple of issues with it. Project Overview: What I Have So Far: As previously described, it is a music-player project made with create-react-app. It has 4 playlists, persian, rock, turkish, and house, whom al…
How can you add 2 classname in a single div in next js?
I tried to add two classname form styles but I could not add two CSS classes in a single div. Here is the screenshot: my code is as follows: blog.js Home.module.css Answer Instead of using single quote, you need to use backtick for template string: Check out this for more context
How to stop my component from being made twice in development
I am following this tutorial to make a javascript calendar in react I have a working calendar UI with the following code However in development, my calendar is made twice I assume this is because of React.StrictMode in development as useEffect seems to be running twice. If I run npm run build and npm start to…
Validation text not showing up. MDBInput Reactjs
I am using Material design Bootstrap for my React project. I made a form, made input field using MDBInput. I am trying to use it’s validation feature but I am not getting any message below it, when I leave the input field empty and click on the login button. I am getting red border though. Here is the i…
typescript is there a way to remove the array from an property?
I have this model: and then I have another model and I need the sizeAndColor but without a array. How can I say at options that I want to have this interface without the array? is that possible ? Answer Assuming that SizeAndColors really is declared as an array type where the elements are objects with size an…
React Router v6 shows blank Webpage when trying to link webpages together
I am trying to follow lamadevs Basic blog tutorial for the UI in React on youtube. In the last section of the video I am unable to link my webpages together in App.js because he uses version 5 instead of 6. I tried switching the switch to route instead but it also didnt work. Do I have to download the
how to use value of useState after init it
I these state hook: my medicalProblem variable will initial with response of a api : but I got this error: Answer There are a couple ways to accomplish this, but the easiest may be creating another useEffect hook that depends on the medicalProblems array as seen below! That extra hook will make sure your medi…
Dropdowns are not working using react-draft-wysiwyg in React JS
I tried to use react-draft-wysiwyg using the docs Some icons are displayed but not working : block type, font, font size,pickerColor (the dropdowns are not working). For example, the font size is set to 16 by defauft, but I can’t change it… Answer Well that’s weird, I have no explanation for…
Tailwind default color classes not working
I’m building a React application using Tailwind CSS Framework. I have used NPM to install tailwind in my react app in the following manner: Then I have also edited my tailwind.config.js file in the following manner: And updated my index.css file in the following manner: Then I tried to use default color…