Skip to content

soyed/e-commerce-project

Repository files navigation

new-react-project

Not sure what to call it yet... or what to do yet.😭

Problems Faced
  • React Router failing

  • App Routing to match the Endpoints being consumed

    • The navigation on the webpage is not the same with the endpoint being sent to fetch from the server
      • Reasons
        • Endpoints are not names to match preferred route structure
        • Also, not the standard way to go as React-router-dom document states the webpage routes need to match the endpoint URL for the server.
    • Nested Routes in React
    • useRouteMatch is a react-router hook that is used for extract your route path or url.
  • React Redux

    • "cyclic import dependency" using CreateSelector from 'reselect'
      • CreateSelector is a custom hook built to memoize the content selected from reducers
        • A perfect explanation for this would be grabbing references from store
        • Areference select from store always renders the content of whatever component is using the selected properties
        • https://redux.js.org/tutorials/fundamentals/part-7-standard-patterns
        • There is another way to that can handle memoizing with useSelector hook from react-redux
          • Another approach to memoize selected properties is using shallowEqual from react-redux which is used to check for changes in the selected properties using useSelector Hook
  • Redux-thunk and Middle Ware

  • Enchancers

  • MiddleWare / Async Operations in redux

  • Webpack Optimization

  • Dynamic imports - can be done using react.lazy load feature

  • file splitting - can be problematic => not a recommend standard

  • Redux Persist

  • Important Concepts learnt

  • Redux-Persist stores the redux-store in web browser's local storage => your reducer's can be ke upon revisiting a webpage

    • persistStore => is a hook that store the state of your redux store
    • persistReducer => is a hook that store the state of reducers
    • persistGate => is a hook that delays rendering of your react app while your redux-store states are being re-hydrated (i.e your persistedState is being retrieved and updated with your current redux-store)
    • Persisted State can be configured to match different use cases
      • You can Blacklist or Whitelist a reducer.
        • A blacklisted reducer => does not get store in local storage
        • A Whitelisted reducer => gets stored in local storage
    • My only concern is the redux-state being stored in your local storage
      • Anyone can access information from these states
        • An ideal fix for this? to be researched
    • Resource => https://github.com/rt2zz/redux-persist
  • Hiding Sensitive information using dotenv

    • A custom built react app with webpack does not support process.env out of the box.
    • The package dotenv-webpack helps resolve this issue by simply adding the plugin for this package in webpack.config.js you can inject | export the content of .env into your project and process.env can now be recognized across all tsx?|jsx? files you have created.
    • Source => https://github.com/mrsteele/dotenv-webpack
    • .env not found in the specified path bug

Photo Credits

Releases

No releases published

Packages

No packages published