Navigation Menu

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

change react to be peerdependency #5

Closed
wants to merge 1 commit into from

Conversation

danielhusar
Copy link

@danielhusar danielhusar commented Oct 29, 2018

React can’t be dependency as otherwise you will get error when using this hook:

Hooks can only be called inside the body of a function component.

See demo https://codesandbox.io/s/y3mp7vyr21
Theres open issue for this so it might get fixed but changing react to peer dependency fixes the issue too facebook/react#13991

Sorry for yarn.lock changes, I’m running latest version, but if you tell me which version you used to generate it, I can regenerate.

@jamiebuilds
Copy link
Member

Can you put it in devDeps too

@danielhusar
Copy link
Author

done

@danielhusar
Copy link
Author

Closing for inactivity

@danielhusar danielhusar closed this Dec 7, 2018
@manohar-1998
Copy link

Hii There,
Hope you are doing good,

In Dashboard: Two Buttons
<button onClick={()=>TheFooter('1')} style={TSbutton}>Agri
<button onClick={()=>TheFooter('2')} style={NTSbutton}>Res

In Footer: Iam accessing the props and retreving values accordingly, but in the Show_attendanceee function the return part is not redirecting to the particular component displaying the error
const TheFooter = (props) => {
console.log("In Footer=", props);
return (

{Show_attendanceee({props})}
);

     const Show_attendanceee = (props) => {
              console.log("Props Value=", props);
              if(props.props ==="1"){
                return (
                  <div>{Show_Agri_attendance()}</div>);
              }else if(props.props ==="2")
              return (<div>{Show_attendance()}</div>);

×
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app
    See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.

Help me with the solution plz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants