TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Why is distributing a react component so hard?

3 点作者 jarsbe超过 10 年前
Things were so swell. I built a react.js component, I was so chuffed. I even put a gif on the readme https:&#x2F;&#x2F;github.com&#x2F;jarsbe&#x2F;react-polyselect.<p>I wanted to share my work for others to use (including myself). A simple request right? I remember the days (I&#x27;m so old) when I could make a jQuery plugin, and use it in my project by adding a script tag. It was easy.<p>We seem to have believe now that those methods are a childish way to build a project. You should use a JS tooling system in order to concat, minify, transpile, compile and require. Oh and configure. Configure, configure, configure.<p>I&#x27;ve spent more time working with these tool chain than working on my component. It shouldn&#x27;t be like that.<p>Why is it harder now to share code than when jQuery plugins were popular? Shouldn&#x27;t it be easier now than ever?<p>I don&#x27;t have answers - I&#x27;m simply good at complaining! But I can clearly see that without a simple and easy way to share and use code we are being inefficient. I&#x27;m a programmer. I don&#x27;t like being inefficient.<p>So please, I beg of you, don&#x27;t make me spend hours lurking on irc channels, nagging for answers or rummaging through github projects in order for me to share my work! Instead enlighten me with an answer to this small question - how can I distribute my component?

1 comment

Ronsenshi超过 10 年前
From my little search, it seems like all you need to do is include your component to the project folder and then &quot;require()&quot; it. Seems straightforward enough - same as with any other node modules.<p>You can also upload your component to the npm, so that other could use it. By adding &quot;react-component&quot; keyowrd to the description on npm, your component should be available at <a href="http://react-components.com/" rel="nofollow">http:&#x2F;&#x2F;react-components.com&#x2F;</a>.<p>If you want to use in on the frontend right away, then maybe write it in AMD format, so that you could load it via require.js?
评论 #8580939 未加载