What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-28 08:05:07
component did mount mutation graphql
import React from 'react'; import { Mutation } from 'react-apollo'; class DoMutation extends React.Component { componentDidMount() { const { mutate } = this.props; mutate(); }; render() { return null; }; }; const MutationOnMount = (... Add solution -
Javascript 2021-09-28 03:59:04
route to change a part of component
<Route exact path="/" render={props => ( <Page {...props} component={Index} title="Index Page" /> )} /> <Route path="/about" render={props => ( <Page {...props} component={About} t... Add solution -
Javascript 2021-09-14 16:44:03
scroll to top react
componentDidMount() { window.scrollTo(0, 0) } 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 -
Other 2021-09-14 11:43:03
axios put api in componentDidMount React
componentDidMount() { // Simple PUT request with a JSON body using axios const article = { title: 'React PUT Request Example' }; axios.put('https://reqres.in/api/articles/1', article) .then(response => this.setState({ updatedAt: res... Add solution -
Javascript 2021-09-12 19:33:02
external script in react
componentDidMount() { const script = document.createElement("script"); script.async = true; script.src = "https://some-scripturl.js"; script.onload = () => this.scriptLoaded(); //For head document.head.app... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5