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

React Way Notes: 2019-09-02 #179

Open
justinbmeyer opened this issue Sep 2, 2019 · 2 comments
Open

React Way Notes: 2019-09-02 #179

justinbmeyer opened this issue Sep 2, 2019 · 2 comments

Comments

@justinbmeyer
Copy link
Member

General Guidelines

  • Overall, the guidelines are good ... but I'm not sure they are about "react".
  • Is type checking shown?
@justinbmeyer
Copy link
Member Author

justinbmeyer commented Sep 2, 2019

State management

Managing state via hooks directly in the component

  • I still think a full overview of hooks would be useful here. I can't imagine a training w/o it. Most react developers have probably never used hooks.
  • This needs an exercise, possibly multiple.
  • Examples should be codepen-able.

Custom Hooks and Hook / Provider Pairs

  • The primary impetus for doing this is due to the complexity of the logic. ... Why should complex logic be pulled out? It's not the complexity that drives pulling out "provider pairs", it's reuse right? I think a pagination model might be a good example.
function paginate(limit) {
  const [ count, setCount ] = useState();

  return {
    next(){ ... },
    prev(){ ... },
    get page(){ ... }
  }
}

Adding a Provider

  • I'm unable to follow the example. I think showing createContext / useContext first is probably a good idea.
  • Context.Provider is mentioned w/o an introduction.

@justinbmeyer
Copy link
Member Author

justinbmeyer commented Sep 2, 2019

Data Modeling

  • Make sure to add highlighting.

Simple Models

  • SearchResults ... Should this inherit from Array? Then you get a lot for free.
  • Would Object.assign() be nicer in SearchResult::constructor?

Things that would be interesting to show:

How to unify state changes across multiple components.

Could your models call useState?

class Todo {
  static todosById = {};
  static get(id){
    const [ todo, setTodo ] = useState();
  }
}


function EditTodo(){
  const [todo, setQuery]
}

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

1 participant