Relative Content

Tag Archive for reactjs

React’s context and input field duplicating string characters

import React, { createContext, useContext, useState } from “react”; export const ProductSearchTermContext = createContext([“”, undefined]); function ProductSearchTermContextProvider() { const [searchTerm, setSearchTerm] = useState(“”); function SetSearchTerm(term: string) { setSearchTerm((oldState) => oldState + term); } return ( <ProductSearchTermContext.Provider value={[searchTerm, SetSearchTerm]}> {children} </ProductSearchTermContext.Provider> ); } export default function Input() { const [searchTerm, setSearchTerm] = useContext(ProductSearchTermContext); const onChange = […]

sharing a link via email and whatsapp

below is the function that I created to copy a link, send it via whatsapp and send it via email but it’s showing just simple text on the email and whatsapp what am I missing here?