How can i implement multilingual URL validation in React JS?
Code Snippet: –
import * as Yup from "yup";
const validUrl = require("valid-url");
const validateUrl = (url) => {
const isValidUri = validUrl.isUri(url);
return isValidUri && isValidUri.startsWith("https://");
};
producturl: Yup.string()
.test("url", "Invalid Product Url", (value) => {
return validateUrl(value);
})
.required("Product url field is required"),