Skip to content

Instantly share code, notes, and snippets.

@simbathesailor
Last active January 14, 2020 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simbathesailor/7b3dea5dca91f62bf1401d56ecd8058b to your computer and use it in GitHub Desktop.
Save simbathesailor/7b3dea5dca91f62bf1401d56ecd8058b to your computer and use it in GitHub Desktop.
blog13.md
const option = { a: 1, b: 2, c: 3 };

// Type 1
function useAcceptOptions(option) {
  React.useEffect(() => {
    // also ok, but splices the ability to debug the things , can be anything as the option keys, lets say its a function
    // will screw everything, it was the case in earlier example also but atleast we knew what is coming in option and what to
    // consider for the effect
  }, [...option]);
}

// Type 2
function useAcceptOptions(option) {
  const { a, b, c } = option;
  React.useEffect(() => {
    // all good
  }, [a, b, c]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment