-
Notifications
You must be signed in to change notification settings - Fork 440
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
Convert React wrapper to use functional components/hooks #513
Comments
Thank you :) Here is my Codepen portfolio I am a freelance developer and have been working on countless React components and complex web system/dashboards. Now, the reason why you think I don't know Hooks might be that the Tagify wrapper isn't authored using them, if because of backward-compatibility with old React versions. Regarding your other opened issue, you did not fully answer my question regarding why can't you work with how it is at the moment, and if the issue where Tagify isn't a controlled-component is absolutely stopping you from using it due to technical reasons. I have much-needed tasks to make for Tagify which will take considerable time and have been requested by many users and I the way I queue my open-source work (at my limited free time) is first fix bug, then work on requests & features which affect the maximum amount of developers and only at the bottom are requests which aren't affecting many and aren't a show-stoppers. I really, honestly, want to make Tagify the best component ever but things just take time.. it's a very complex component with a web of hundreds of edge-cases that must be known & considered for any code change. |
Your codepen portfolio is very impressive and this library is incredible. Backwards compatibility is a very valid concern that I did not consider. Thanks for taking a look. |
As of https://github.com/yairEO/tagify/blob/master/src/react.tagify.js |
Dope |
I would def add a useEffect for placeholder as well |
good idea brother. I've never thought about anyone ever wanting to change the placeholder dynamically, but I guess, why not? Currently Tagify does not support changing it, and I would need to think of a way to make this work. |
I had to do it in a project of mine. I just did it super hacky like this. Definitely not best practice but it did what I needed and I couldn't find a scenario where it would break 😂🤘 useEffect(() => { |
Not sure if you think worth pursuing, but I see great benefit in adding an effect for classname Here is an example that would relate to the above screenshots
Not sure if you are familiar with the classnames package but is essentially same thing as className={tags.length !== 0 ? "form-textbox" : "form-textbox fit-width"} |
Also not sure if you are exposing ref but react's "forwardRef" would let you expose your ref of choice like you would typically be able to do in a class component (https://reactjs.org/docs/forwarding-refs.html) |
Yes, I am aware of it. what didn't you like in the source code that made you speak of it? |
React has been shifting towards functional components/hooks. High profile libraries like material-ui have transitioned over to using them. It is a lot more elegant and concise. More on them here: https://reactjs.org/docs/hooks-intro.html. It is also worth noting that certain class component staples are en route to get deprecated: https://reactjs.org/docs/react-component.html see unsafe methods, some of these methods have throw warnings during runtime while running this on newer versions of react.
Here is a basic stab at what it would look like
Let me know if I can provide extra help. I have written React wrappers for other vanilla js libraries :D
The text was updated successfully, but these errors were encountered: