What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-25 15:59:11
nuxt vuex structure
// File path: store/index.js Vue.use(Vuex) export const state = () => ({ // this is a object }) // this is to change state export const mutations = { someFunc(state, payload){ // code } } export const getters = { } // server-side interaction... Add solution -
Javascript 2021-10-22 16:42:06
how to upload document cloddinary
// util.cloud.ts import { v2 as cloudinary } from 'cloudinary' export const cloudStorage = (filename: string): Promise<Record<string, any>> => { return new Promise((resolve, reject) => { cloudinary.config({ cloud_name: process.env... Add solution -
Javascript 2021-10-20 05:35:12
cannot use import statement outside a module from the console.log
//method of exporting variables, contants and... export const greetings = "Hi"; //saved as ex1.js import {greetings} from "[specify path]/JavaScript Exercises/ex1.js"; //saved as mod.js Add solution -
Javascript 2021-10-19 11:05:08
apply back button to a react component
import { useHistory } from "react-router-dom"; export const Item = () => { let history = useHistory(); return ( <> <button onClick={() => history.goBack()}>Back</button> </> );... Add solution -
Other 2021-10-18 16:34:13
store data to the browser’s localStorage
export const setToLS = (key, value) => { window.localStorage.setItem(key, JSON.stringify(value)); } export const getFromLS = key => { const value = window.localStorage.getItem(key); if (value) { return JSON.parse(value); } } Add solution -
Javascript 2021-10-17 02:11:03
react pagination scroll
import { useState, useEffect, useCallback } from 'react' export const LoadMoreItem = (props) => { const [increment, setIncrement] = useState(4) const [disabled, setDisabled] = useState(false) const [hidden, setHidden] = useState(false) useEffect(... Add solution -
TypeScript 2021-10-03 14:03:02
angular shared animation
//Create an animation.ts file: import { trigger, state, style, transition, animate } from '@angular/core'; export const slideIn = trigger('slideIn', [ ...the animation... ]); //In the component.ts import { slideIn } from './animations'; // path to y... Add solution -
Other 2021-09-30 20:43:02
apollo server file upload
//resolvers.js export default { Query: { usersActivation() { return 'Hello Wordl' } }, Mutation: { uploadFile: async (parent, { file }) => { const { filename, createReadStream } = await file.promise fileUpload({ filename, stream: cre... Add solution -
Javascript 2021-09-30 12:47:02
installing vue router & implementation
//Installing Vue Router npm install vue-router //Implementation //main.js - Add below lines import VueRouter from 'vue-router'; Vue.use(VueRouter); const router = new VueRouter({ routes, mode: 'history' }); new Vue({ router, render: h => h(... Add solution