Giter Club home page Giter Club logo

javascript-react-patterns's Introduction

javascript-react-patterns's People

Contributors

lydiahallie 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  avatar

javascript-react-patterns's Issues

Text component should also receive props with style property in Higher Order Component pattern

export function withStyles(Component) {
  return (props) => {
    const style = {
      color: "red",
      fontSize: "1em",
      // Merge props
      ...props.style,
    };

    return <Component {...props} style={style} />;
  };
}
import { withStyles } from "./hoc/withStyles";

const Text = () => <p style={{ fontFamily: "Inter" }}>Hello world!</p>;
const StyledText = withStyles(Text);

In the Higher Order Component Pattern section, the example of withStyles higher order component and Text component. Since withStyles returns a new component with style props, should Text component receive the props.style as well? Otherwise the paragraph style inside Text component won't be updated.

I think the Text component should look like this.

import { withStyles } from "./hoc/withStyles";

const Text = (props) => <p style={{ fontFamily: "Inter", ...props.style }}>Hello world!</p>;
const StyledText = withStyles(Text);

https://javascriptpatterns.vercel.app/patterns/react-patterns/higher-order-component

There are some typos and the fullName method doesn't exist in the User class

There are some typos in
https://github.com/lydiahallie/javascript-react-patterns/blob/main/pages/patterns/design-patterns/factory-pattern.mdx

The fullName method is the same for all the objects that were created. By creating new instances, the fullName method is available on the prototype instead of on the objec, which saves memory.

It should be ... on the prototype instead of on the object....

In this section, the fullName method doesn't exist in the User class. There is the getPosts method instead.

https://javascriptpatterns.vercel.app/patterns/design-patterns/factory-pattern#tradeoffs

Issue with automatically scrolling to unintended element positions

As the title suggests, sometimes the timing of page transitions causes the page to scroll to an unintended position.

As shown in the following video, the page will automatically move to the Excercise area instead of the Overview area at the time of page transition.

2022-09-11.19.20.21.mov

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.