Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a good documentation #21

Open
the-wrong-guy opened this issue Jul 29, 2020 · 3 comments
Open

Make a good documentation #21

the-wrong-guy opened this issue Jul 29, 2020 · 3 comments

Comments

@the-wrong-guy
Copy link

the-wrong-guy commented Jul 29, 2020

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"
  }
}
@laxmikanthk
Copy link

I am also facing the same issue when using "auto" property, getting "TypeError: children is not a function".
Any one know how to auto reload when there is new version?

@ghershko3
Copy link

They have an example folder in the repo, it supposed to be:

"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "prebuild": "npm run generate-build-meta",
    "generate-build-meta": "./node_modules/react-clear-cache/bin/cli.js"
  },

@wudstrand
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants