I want to be able to put a maximum length for the phone number entered and don’t allow any characters too. However, with the format below it does limit the person to enter 10 characters but it also allows any other character to be added too. Now if I change type to type=”number” maxLength wi…
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 position a real Docx file in a Material CardMedia
I have a Codesandbox I have this app that displays different files like jpg, mp4 or now docx files. I can’t make docx file position so it look good but jpg or mp4 is working OK. Try it just open a doxc file. In file FileContentRenderer.jsx here below I use switch case and n open Component needed like do…
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
Nav Element Disappears When Parents Element’s Position Changed to Sticky
I have a navbar div that has a title and a nav component. When the window gets small enough I collapse the nav element so have a burger to show and hide the nav element. Without changing the position attribute of the parent navbar div it works fine, however when I make the parent navbar div sticky I can no
How to iterate json consists of array elements
I am getting this object : I want this kind of table after iteration. I’ve converted it to array : console log after converting it to array I want to fill this data in table format I am working on React js, I want to do this in javascript. Any help would be appreciated. Answer Try this one.
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…