Skip to content

Make a good documentation #21

Open
@the-wrong-guy

Description

@the-wrong-guy

I do not understand how to use this library

=> Does this library only clears the cache automatically when a new update is pushed or we need to provide an external button to the users to clear the cache manually?

=>Should I wrap the App between like this , will it automatically clear the cache when I push an update? cause when I use this in the index.js it gives me an error: "index.tsx:101 Uncaught TypeError: children is not a function"

eg:

import React from 'react';
import ReactDOM from 'react-dom';
import {BrowserRouter} from 'react-router-dom'
import './index.css';
import BackToTop from './menu'
import ClearCache from 'react-clear-cache';
import * as serviceWorker from './serviceWorker';

ReactDOM.render(
  <ClearCache auto={true}>
    <BrowserRouter>
      <BackToTop/>
    </BrowserRouter>
    </ClearCache>,
  document.getElementById('root')
);

serviceWorker.register();

=>Where should I put scripts and how

like this inside the pakage.json

{
 "name": "my-own-app",
 "version": "0.1.0",
 "private": true,
 "dependencies": {
   "@material-ui/core": "^4.10.1",
   "@material-ui/icons": "^4.9.1",
   "@material-ui/lab": "^4.0.0-alpha.55",
   "@testing-library/jest-dom": "^4.2.4",
 },
 "scripts": {
   "start": "react-scripts start",
   "build": "react-scripts build",
   "test": "react-scripts test",
   "eject": "react-scripts eject"
 },
 "eslintConfig": {
   "extends": "react-app"
 },
 "browserslist": {
   "production": [
     ">0.2%",
     "not dead",
     "not op_mini all"
   ],
   "development": [
     "last 1 chrome version",
     "last 1 firefox version",
     "last 1 safari version"
   ]
 },
   "prebuild": "npm run generate-build-meta",
   "generate-build-meta": "./node_modules/react-clear-cache/bin/cli.js"
}

OR

{
  "name": "my-own-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@material-ui/core": "^4.10.1",
    "@material-ui/icons": "^4.9.1",
    "@material-ui/lab": "^4.0.0-alpha.55",
    "@testing-library/jest-dom": "^4.2.4",
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  {
    "prebuild": "npm run generate-build-meta",
    "generate-build-meta": "./node_modules/react-clear-cache/bin/cli.js"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions