DEV Community

Discussion on: Inner Hooks: New idea of React Hooks

Collapse
 
alfredosalzillo profile image
Alfredo Salzillo

I'm not saying is invalid React, I'm only saying it's more complex than using React the simple way, and it's not needed.
In the examples made, the code look worst than abstracting using custom hooks or other solution.
It's more difficult to read and understand.
Also innerHooks mean nothing, it's not clear how you have to use it, what should the function return? If someone read this code after one month will not understand why it's done this way and what it's doing whiteout enter the Field component.

Good code must be readable and understandable. This is not.

Thread Thread
 
ivan_jrmc profile image
Ivan Jeremic • Edited

Yeah agree the example above doesn't make any sense however I would like to see a dom node hook api like I said this makes sense indeed, if you are not familiar with it try the element hooks which Svelte.js has quickly in Codesandbox , they are awesome.

Thread Thread
 
tkow profile image
tkow • Edited

My library written in typescript and type inference works as you won't lose what totally you should return as partial props and rest props from component is validated by inferred rest props and vise versa. The returned value allows only key-value of the partial component props.

I'm on your side about with no abstraction code is very bad for general components (Most of them are presentational), but there are some limited cases you may not come across that build and scrap each condensable components in one component is preferred to courteous declarative or split components. These will need just only container injection in most cases.

Please be tolerant. I don't think your opinion is wrong. Please don't fight anyone for the reason they are different from you to make meaning discussion though it may be needless to say.