skip to Main Content

Reactjs – React hooks and comparing object references

I have fallen into the too-many-rerenders trap while implementing my own hook. The hook itself looked like this: function useRegexValidate(value: string, regex: RegExp, errorMessage: string, deps: any[] = []): ValidationResult { const [result, setResult] = useState<ValidationResult>(ValidationResult.Valid); useEffect(() => { if…

VIEW QUESTION

Javascript – How to display updated data without refreshing the page?

I'm creating an update function with React: function Company(props) { const { contact, company, companies, setCompanies } = props; const [isEditing, setIsEditing] = useState(false); const [editedName, setEditedName] = useState(company.company_name); const [editedAddress, setEditedAddress] = useState(company.company_address); async function deleteCompany() { const response…

VIEW QUESTION

Html – pass the search item into url

I am trying to learn react by practising a simple problem. I followed the below youtube tutorial https://www.youtube.com/watch?v=AsvybgZTryo&list=PLKhlp2qtUcSZiWKJTi5-5r6IRdHhxP9ZU&index=17 but when I search for an item the item is not passing properly in the api call https://dummyjson.com/users/search?q=${searchTerm} can you let me…

VIEW QUESTION
Back To Top
Search