Skip to content

Tag: reactjs

Unable to set up the new Faker library

I am trying to set up the new @faker-js/faker library. So far, I did this: Added faker.d.ts at the top level. So the tree is like this: faker.d.ts contents is this: I am trying to use the mock like this: But am keep getting an error, saying Cannot find module ‘faker’ or its corresponding type decl…

How to delete multiple url params

There is a problem with deleting several string parameters. Only the last parameter is being deleted now. upd: I did not specify that I wanted to achieve the ability to remove specific parameter values this code does not work correctly: Sandbox Answer Solved the problem by modifying the function like this

React dynamic form input

I have a React form with dynamic input fields that a user can add and remove input fields. When i submit the form, i log the values from each input in an array. The problem is that i can’t type continuously in a input. When i type in input, i can type only one character and it focus out. How

Change style of the text dynamically React js

I want to change some styles of the text of the tab for my navbar. I want to switch between pages whenever I click the on the tab. And for that I want that tab to be active. I have written code as: Header.js Header.css Tab.js Tab.css Now when I click the tab it becomes active and clicking another tab

Update UI within .map() when condition changes?

I have a array posts, and a separate array favourites. I want the UI to display “Favourited: [Yes or No]” depending on if favourites includes the value from posts. The problem is when I add to favourites the UI never updates. I made a minimal example here: https://codesandbox.io/s/usestate-useeffe…

Tailwind CSS Grid Spacing Messed Up

I am trying to make a blog website with two columns for the posts. The first column displays one large-format post while the second displays 3 small-format posts (pictured below). However, when i do this to small-format posts seem to respect the spacing of the large-format post, even though they are in differ…