What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-02-01 22:45:24
nuxt error page
// layouts/error.vue <template> <div class="nuxt-error"> <component :is="errorPage" :error="error" /> </div> </template> <script> import error404 from '~/components/error/404.vue'; ... Add solution -
Javascript 2022-02-01 21:40:08
how destructuring works in javascript
const objA = { prop1: 'foo', prop2: { prop2a: 'bar', prop2b: 'baz', }, }; // Deconstruct nested props const { prop1, prop2: { prop2a, prop2b } } = objA; console.log(prop1); // 'foo' console.log(prop2a); // 'bar' console.log(prop2b); // 'baz' Add solution -
Javascript 2022-02-01 13:26:17
event listener for functional component
import React, { useEffect } from 'react'; const Component = (props) => { useEffect(() => { window.addEventListener('scroll', handleScroll); }); useEffect(() => { return () => { window.removeEventListener('scroll', handle... Add solution -
Javascript 2022-02-01 06:06:18
how to get a value into a react component
class NameForm extends React.Component { constructor(props) { super(props); this.handleSubmit = this.handleSubmit.bind(this); this.input = React.createRef(); } handleSubmit(event) { alert('A name was submitted: ' + this.input.curren... Add solution -
Other 2022-01-31 10:46:14
create global styles in styled components
import { createGlobalStyle } from 'styled-components' const GlobalStyle = createGlobalStyle` body { color: ${props => (props.whiteColor ? 'white' : 'black')}; } ` // later in your app <React.Fragment> <GlobalStyle whiteColor />... Add solution -
Javascript 2022-01-31 09:06:00
change items loop react
import React from 'react'; import './HomePage.scss' import { Col,Row, Button, Container } from "reactstrap"; let image1 = require("../../Assets/image1.jpg"); let image2 = require("../../Assets/image2.jpg"); let image3 = requi... Add solution -
TypeScript 2022-01-31 07:56:35
sdadsa
import React, { Component } from "react"; import RichTextEditor, { stateToHTML } from "react-rte"; // import ReactHtmlParser from 'react-html-parser'; // import { stateToHTML } from "draft-js-export-html"; class MyStatefulEditor extends Component { ... Add solution