Giter VIP home page Giter VIP logo

epic-react-exercises's Introduction

epic-react-exercises's People

Contributors

dependabot[bot] avatar jpalala avatar mithi avatar mskeving avatar r002 avatar vishal-rathod-07 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

epic-react-exercises's Issues

Remove warnings when building

02:34:44.495  	Installing dependencies...
02:34:47.746  	npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
02:34:53.536  	npm WARN @reach/[email protected] requires a peer of react@^16.8.0 but none is installed. You must install peer dependencies yourself.
02:34:53.545  	npm WARN @reach/[email protected] requires a peer of react-dom@^16.8.0 but none is installed. You must install peer dependencies yourself.
02:34:53.553  	npm WARN @reach/[email protected] requires a peer of react@^16.8.0 but none is installed. You must install peer dependencies yourself.
02:34:53.561  	npm WARN @reach/[email protected] requires a peer of react-dom@^16.8.0 but none is installed. You must install peer dependencies yourself.
02:34:53.569  	npm WARN @reach/[email protected] requires a peer of react@^16.8.0 but none is installed. You must install peer dependencies yourself.
02:34:53.577  	npm WARN @reach/[email protected] requires a peer of react-dom@^16.8.0 but none is installed. You must install peer dependencies yourself.
02:34:53.586  	npm WARN [email protected] requires a peer of @types/react@>=16 but none is installed. You must install peer dependencies yourself.
02:34:53.599  	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
02:34:53.599  	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
02:34:53.613  	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/watchpack-chokidar2/node_modules/fsevents):
02:34:53.613  	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

πŸ‡πŸ‡πŸ‡ Refactor top-level context providers for performance

There are currently three top level providers for handling the ui state:

I have to refactor this to best practices so that the app will be faster considering the following techniques:

  1. How to optimize your context value by separating state and dispatch
  1. By using useCallback and useMemo for state update functions https://github.com/kentcdodds/kentcdodds.com/blob/319db97260078ea4c263e75166f05e2cea21ccd1/content/blog/how-to-optimize-your-context-value/index.md

Be sure to measure the performance before and after with chrome dev tools and react component profilers
to make sure the changes introduced actually does make things faster... not slower.

Refactor `DynamicMarkdown`

I've been copy pasting this everywhere. Put this somewhere to be reusable

import dynamic from "next/dynamic"
import { SpinnerDots } from "components/spinner"


const DynamicMarkdownRender = dynamic(() => import("components/markdown-render"), {
    // eslint-disable-next-line react/display-name
    loading: () => <SpinnerDots />,
})

They're found in the following:

  • theme-menu.js
  • content/react/advanced-hooks/3
  • content/landing
  • pages/react/[section]

Each article/page should have its own title

Create a pageProperties.json that contains the title and description of that page content/topic/section/pageId

Edit to read and return pageProperties

https://github.com/mithi/epic-notes/blob/d624a04bb0733088f067095c08679a07ac286828/utils/index.js#L54

Edit this component to destructure the return of pageContents

https://github.com/mithi/epic-notes/blob/d624a04bb0733088f067095c08679a07ac286828/pages/react/%5Bsection%5D/%5BpageId%5D.js#L18

that passes it to

https://github.com/mithi/epic-notes/blob/d624a04bb0733088f067095c08679a07ac286828/components/notebook/index.js#L158

add

<Head> 
<meta property="og:url" content={currentURL} key="ogurl" />
<meta property="og:image" content={previewImage} key="ogimage" />
<meta property="og:site_name" content={siteName} key="ogsitename" />
<meta property="og:title" content={pageTitle} key="ogtitle" />
<meta property="og:description" content={description} key="ogdesc" />
</Head>

or something

References

https://www.netlify.com/blog/2020/05/08/improve-your-seo-and-social-sharing-cards-with-next.js/

`useTheme()` etc hooks

instead of doing this:

import { useContext } from "react"
import { ThemeContext } from "providers"

const  x = useContext(ThemeContext)

I should do it like this

import { useTheme } from "hooks"

const x = useTheme()

πŸ‡ Reduce bundle size of first load page

Screen Shot 2020-12-23 at 9 45 14 AM

https://www.eliostruyf.com/devhack-optimizing-initial-load-js-nextjs/
https://nextjs.org/docs/advanced-features/dynamic-import
https://medium.com/ne-digital/how-to-reduce-next-js-bundle-size-68f7ac70c375
https://blog.logrocket.com/slimming-down-your-bundle-size/


dynamic from 'next/dynamic';
 // Loading StickerForm component, showing spinner while fetching the component 
// Use it like you're use to <StickerForm /> 
const StickerForm = dynamic(() => import('./StickerForm'), { loading: () => <Spinner /> });

better layout

  • Make border dashed
  • Add margin bottom to bottom icons

Screen Shot 2021-02-16 at 6 24 05 AM

Bug: Hide ugly scrollbars on Windows.

image

image

When I run your app on my Windows machine in Chrome and Edge, I'm seeing horrible scrollbars that uglyify the GUI.
This should be a simple CSS fix.

I noticed in your Reddit video that the scrollbars don't appear though. I am guessing you are on Mac?

🐞🐞🐞 Fix html semantics `a` tag vs `button` tag

Anchor elements are often abused as fake buttons by setting their href to # or javascript:void(0) to prevent the page from refreshing, then listening for their click events .

These bogus href values cause unexpected behavior when copying/dragging links, opening links in a new tab/window, bookmarking, or when JavaScript is loading, errors, or is disabled. They also convey incorrect semantics to assistive technologies, like screen readers.

Use a instead. In general, you should only use a hyperlink for navigation to a real URL.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a

Error boundary opinions

so I'm reading about error boundaries and I'm seeing opinions like:

error boundaries should only be used for unexpected errors that would otherwise crash a react tree

or

Your code should gracefully handle API errors and not rely on an Error Boundary for "known" UI state.
or

An unexpected error is still an error. (We don’t recommend using error boundaries for expected errors or control flow.)

Error boundaries are primarily useful for production, but in development we want to make errors as highly visible as possible.

What is your opinion on this? Should we handle "expected" errors (example: promise-based errors or network failed errors etc) with a try-catch block and ONLY use error boundaries for "unexpected" errors?

I have seen some discussions bringing up the experimental suspense feature but is it okay to rely on it when it's still experimental?

Thanks in advance!

Some Discussions:

Add another exercise in react hooks

Create a folder inside content/react/hooks and name it the next integer.
Example 5 in this case, since the last number is 4

Screen Shot 2021-10-03 at 6 26 50 PM

Inside that folder create 2 files: notes.md and app.js

Screen Shot 2021-10-03 at 6 29 30 PM

Write your example app in app.js and export it as default

const App = () => {
  return <>Hello world!</> 
}

export default App

Write the description of your exercise in notes.md.

## The hello world exercise

> Summary: Display `hello world` on the screen!

🐞🐞 Investigate useLayoutEffect warnings by next js

Screen Shot 2020-12-22 at 8 22 42 AM

https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85

// ***************
// IMPORTANT: Use isomorphic effect
// ***************
// React currently throws a warning when using useLayoutEffect on the server.
// To get around it, we can conditionally useEffect on the server (no-op) and
// useLayoutEffect in the browser. We need useLayoutEffect because we want
// `connect` to perform sync updates to a ref to save the latest props after
// a render is actually committed to the DOM.

Inconsistent buttons

Notice the pagination buttons are different...

on desktop safari on mobile safari
Screen Shot 2021-01-28 at 3 02 03 AM Screen Shot 2021-01-28 at 3 02 03 AM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.