Issue 1:
It works in class component but in the hooks the val function calling infinity times

can any one have solution for this...........

import React, { useState } from 'react'

function Inhook(props) {

const initialState = 0;

const [records, setRecords] = useState([]);

const [count, setCount] = useState(initialState);

const [show, setShow] = useState(false);

const [store, setStore] = useState(initialState);

const [store1, setStore1] = useState(initialState);

setRecords(props.records);

function val(e) {
debugger;
console.log("hhh", e);
setStore(e);
if (store === store1) {
if (count == 0) {
setShow(true);
}
else {
setShow(false);
}
}
else {
setShow(true);
setCount(0);
}
setCount(count + 1);
// console.log(count,'counttt');

setStore1(e);
}
return (
<div>
<React.Fragment>
<br />
<div className="Tree">
<h1 style={{ textAlign: "center" }}>Employee Tree</h1>
<h3>Test Case 1</h3>
<h4>Employee Tree</h4>
{
records.sort((x, y) => (x.empName.toLowerCase() > y.empName.toLowerCase()) * 2 - 1),
records.map(empId => {
return empId.managerId === 0 ?

<ul key={empId.id} >
<li style={{ fontWeight: "Bold" }}>{empId.empName.toLowerCase()}
<p>Employees of : {empId.empName.toLowerCase()}</p>
<ul>
{records.map((s) => (s.managerId === empId.id ?
<li type="square" key={s.id}>{s.empName.toLowerCase()}
{
empId.managerId === s.id ? <p>Employees of : {s.empName.toLowerCase()}</p> : <p></p>
}
{records.map((e) => (e.managerId === s.id ? <div>
{
e.managerId === s.id ? <p >{val(s.id)}</p> : <p></p>
}
{
show ? <p >Employees of : {s.empName.toLowerCase()}</p> : <p></p>
}
<li key={e.id} type="disc" style={{ marginLeft: '120px' }}>{e.empName.toLowerCase()}
</li></div> : ""
))}
</li> : ""
))}
</ul>
</li>
</ul> : ""
})}
</div>
</React.Fragment>
</div>
)

}

export default Inhook

Issue 2:
Hello,

I have an error regarding hooks in a lerna architecture project where we import a ux lib made of style component inside a react project.

If component are host in the same app, error is not thrown.

Do you want to request a feature or report a bug?

Report a bug

What is the current behavior?

An error is thrown:

Invariant Violation: Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call)
at invariant (http://localhost/static/js/main.chunk.js:121537:23)
at resolveDispatcher (http://localhost/static/js/main.chunk.js:122922:36)
at useRef (http://localhost/static/js/main.chunk.js:122956:28)
at useStateWithGetter (http://localhost/static/js/main.chunk.js:39121:71)
at useField (http://localhost/static/js/main.chunk.js:39161:35)
at http://localhost/static/js/main.chunk.js:39417:27
at renderWithHooks (http://localhost/static/js/0.chunk.js:70682:22)
at mountIndeterminateComponent (http://localhost/static/js/0.chunk.js:72686:17)
at beginWork (http://localhost/static/js/0.chunk.js:73237:20)
at performUnitOfWork (http://localhost/static/js/0.chunk.js:77166:16)
at workLoop (http://localhost/static/js/0.chunk.js:77207:28)
at renderRoot (http://localhost/static/js/0.chunk.js:77287:11)
at performWorkOnRoot (http://localhost/static/js/0.chunk.js:78232:11)
at performWork (http://localhost/static/js/0.chunk.js:78142:11)
at performSyncWork (http://localhost/static/js/0.chunk.js:78116:7)
at requestWork (http://localhost/static/js/0.chunk.js:77971:9)
at scheduleWork (http://localhost/static/js/0.chunk.js:77778:9)
at scheduleRootUpdate (http://localhost/static/js/0.chunk.js:78482:7)
at updateContainerAtExpirationTime (http://localhost/static/js/0.chunk.js:78508:14)
at updateContainer (http://localhost/static/js/0.chunk.js:78576:14)
at ReactRoot.push../node_modules/react-dom/cjs/react-dom.development.js.ReactRoot.render (http://localhost/static/js/0.chunk.js:78889:7)
at http://localhost/static/js/0.chunk.js:79041:18
at unbatchedUpdates (http://localhost/static/js/0.chunk.js:78359:14)
at legacyRenderSubtreeIntoContainer (http://localhost/static/js/0.chunk.js:79037:9)
at Object.render (http://localhost/static/js/0.chunk.js:79112:16)
at boot (http://localhost/static/js/main.chunk.js:207505:52)
at http://localhost/static/js/main.chunk.js:207517:10

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:

Use this public repo and follow the readme.

It's a good representation of our project's architecture.

You will experience the error.

What is the expected behavior?

Not throwing an error about hooks and displaying a working form.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

Well, didn't tested before 16.8.0. But using react-form instead of informed works.

An issue has been open on informed repository.

II have the feeling that it's more related to React than informed itself.

I am aware of this page but nothing worked.