Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48980

Syntax error: Unexpected token error

$
0
0

I’m getting attached error while running the code Chrome development tool

Here is the code

import { useState } from "react";

export function useLocalStorage (key, defaultValue){
    const getInitialValue = () => localStorage.getItem(key) ?? defaultValue;
    const [value,setValue] = useState(getInitialValue);
    const SetAndStoreValue = (newvalue) => {
        setValue(newvalue);
        localStorage.setItem(key,newvalue);
    }
    return [value,SetAndStoreValue];


}

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48980

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>