Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

download json file react


  const exportData = () => {
    const jsonString = `data:text/json;chatset=utf-8,${encodeURIComponent(
      JSON.stringify(data)
    )}`;
    const link = document.createElement("a");
    link.href = jsonString;
    link.download = "data.json";

    link.click();
  };

  return (
    <div className="App">
      <h1>Hello CodeSandbox</h1>
      <h2>Start editing to see some magic happen!</h2>
      <button type="button" onClick={exportData}>
        Export Data
      </button>
    </div>
  );
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: mvc asp.net partial view from js 
Javascript :: get class of object javascript 
Javascript :: how to read excel file in nodejs 
Javascript :: reach last array js 
Javascript :: javascript function expression 
Javascript :: date range picker jquery 
Javascript :: open modal using jquery 
Javascript :: javascript quiz questions and answers 
Javascript :: javascript css 
Javascript :: js find 
Javascript :: print a number with commas as thousands separator 
Javascript :: javascript scrape page 
Javascript :: disable a function javascript 
Javascript :: is there an api for netflix shows 
Javascript :: reduce function in javascript 
Javascript :: javascript expression 
Javascript :: axios remove existing token 
Javascript :: setting up a react environment 
Javascript :: flatmap js 
Javascript :: javascript prompt on window close 
Javascript :: how to remove the elements from array and how to replace a new element in javascript 
Javascript :: star print in javascript 
Javascript :: how to count click events javascript 
Javascript :: convert datetime value to time only in reactjs 
Javascript :: macam macam looping javascript 
Javascript :: freenom 
Python :: jupyter notebook warning off 
Python :: seaborn rotate x labels 
Python :: display maximum columns pandas 
Python :: pip install mysqldb 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =