reduxjs / redux-toolkit

The official, opinionated, batteries-included toolset for efficient Redux development
https://redux-toolkit.js.org
MIT License
10.7k stars 1.17k forks source link

Update Redux core examples? #3910

Open markerikson opened 10 months ago

markerikson commented 10 months ago
markerikson commented 10 months ago

From Lenz:

  <!--
    JSPM Generator Import Map
    Edit URL: https://generator.jspm.io/#U2VhYGBkDM0rySzJSU1hKEpNKa1wMNEz0jMEALgXm0gaAA
  -->
   <script type="importmap">
  {
    "imports": {
      "redux": "https://ga.jspm.io/npm:redux@4.2.1/es/redux.js"
    },
    "scopes": {
      "https://ga.jspm.io/": {
        "@babel/runtime/helpers/esm/objectSpread2": "https://ga.jspm.io/npm:@babel/runtime@7.23.4/helpers/esm/objectSpread2.js"
      }
    }
  }
  </script>

  <!-- ES Module Shims: Import maps polyfill for older browsers without import maps support (eg Safari 16.3) -->
  <script async src="https://ga.jspm.io/npm:es-module-shims@1.8.2/dist/es-module-shims.js" crossorigin="anonymous"></script>

  <script type="module">
    import * as redux from "redux";

    // Write main module code here, or as a separate file with a "src" attribute on the module script.
    console.log(redux);
  </script>
AntonOfTheWoods commented 10 months ago

@markerikson , this might be a bit of a hijack... sorry. I have a use case that seems pretty reasonable but I just can't get started. I have been happily using RTK for few years and now want to start using RTK Query. Within function components with hooks (as long as I add a few @ts-ignores due to this), it seems to be working ok.

Unfortunately, I need to be able to also use the store outside of function components (in inferno class components via inferno-redux -> I have some super-high-performance needs and plain react is just too slow...) and I just can't get started. I can't get any of the examples here to run and there don't seem to be any instructions on the expected way to run them. The supported way to install now appears to be with vite (which I have also been using for years) but most/all of the examples still use create-react-app, and I'm getting various different errors trying to install. Because there I couldn't find instructions, I don't know whether I'm just holding it wrong.

It is probably temporary but codesandbox also seems a bit foobared. I tried to download the class-based components example but it refused to download (something about Chrome now refusing sandbox downloads?) and there are also errors when trying to create a github repo.

So I am now a couple of hours in and still can't get an official example running. Is there something else I should be doing? Thanks!