What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-15 08:27:03
react proptypes example
import PropTypes from 'prop-types'; MyComponent.propTypes = { // You can declare that a prop is a specific JS type. By default, these // are all optional. optionalArray: PropTypes.array, optionalBool: PropTypes.bool, optionalFunc: PropTypes.fun... Add solution -
Javascript 2021-09-15 07:03:04
difference between useHistory and props.history
//You can use useHistory() in any component, //but props.history only in components where the history is available in props //When you use history.push, you do NOT have to specify the pathname. const queryString = new URLSearchParams(params).toString(... Add solution -
Javascript 2021-09-14 22:06:01
private routes in react
import React from 'react'; import { BrowserRouter, Route, Switch, Redirect } from 'react-router-dom'; import decode from 'jwt-decode'; import Home from './Home'; import Register from './Register'; import Login from './Login'; import PrivateCompon... Add solution -
Javascript 2021-09-14 12:51:03
cascading dropdown for forms react
import React from 'react'; class Dropdown extends React.Component { constructor(props) { super(props); this.state = { countries : [], states : [], cities : [], selectedCountry : '--Choose Country--', selectedState : '--Choose State--'... Add solution -
Javascript 2021-09-14 08:01:03
controlled components reactjs interview questions
function FormValidation(props) { let [inputValue, setInputValue] = useState(""); let updateInput = e => { setInputValue(e.target.value); }; return ( <div> <form> <input type="text" value={input... Add solution -
Javascript 2021-09-13 01:15:03
how to access both child event param and parent param in vue
<template> <ul> <product v-for="product in products" :product="product" @add="addToChart" /> </ul> </template> <script> const Product = { ... Add solution -
Other 2021-09-12 23:12:03
react-image-lightbox npm
import React, { Component } from 'react';import Lightbox from 'react-image-lightbox';import 'react-image-lightbox/style.css'; // This only needs to be imported once&... Add solution
Best helpers
Ranking is empty