Show HN: Copy React code from any site (sample-code.aspect.app)
I made this because building React components from scratch is super annoying. Most visual elements already exist on the web, and I figured there should be a way to leverage that. I hope it's useful!
82 comments
[ 4.3 ms ] story [ 135 ms ] threadLoving where you're going with Aspect. It fits the ux/component dev persona much better than Pagedraw did, for example. What's your monetisation strategy?
but real question on the value, IMO this tool is very useful for beginners, but myself being more experienced now, I would not use it. The html structure and the inline style are not good enough right now.
Edit: view source exists of course, and I think we’ve all copy pasted something from a source view out of convenience but something about copying entire components with styles and everything just feels wrong, and possibly legally grey depending on who you might piss off if you get caught, to me
I predict that they will create this for Angular, Vue, Svelte, etc.
Just because you technically can copy something doesn't mean you're allowed to make and distribute copies or derivatives. If you do this professionally, you'll get yourself or your employer sued, and/or your work pulled off the internet against your will.
You wouldn't steal a policeman's helmet, etc.
https://en.m.wikipedia.org/wiki/Berne_Convention
This is false. You can't copy a site's code and just change the design and poof, no copyright infringement.
But Google scraping the web is somehow allowed? I'm not against it but these laws seem arbitrary.
Copyright exists to encourage more copyable stuff to be made (pg has a good essay on this topic, where he observes history shows the opposite of a copyright regime isn't openness... It's guilds and secrecy cults). What Google does (interpreting the data that scans to help you find references to searches) is considered either transformative work, or recitation of fact. Copyright does not prevent somebody from doing those things because those things make works discoverable, which encourages people to make more stuff.
This is a backward legitimization attempt. Copyright was made because editors, authors and composers lobbied to get a monopoly on their creations and derivative work. As a matter of fact, copyright was continuously expanded on requests from rent-seeking copyright holders (which, in the overwhelming majority of case, aren't creators of any kind).
Not if you believe Jefferson's thoughts on the topic.
"It has been pretended by some, (and in England especially,) that inventors have a natural and exclusive right to their inventions, and not merely for their own lives, but inheritable to their heirs. But while it is a moot question whether the origin of any kind of property is derived from nature at all, it would be singular to admit a natural and even an hereditary right to inventors. It is agreed by those who have seriously considered the subject, that no individual has, of natural right, a separate property in an acre of land, for instance. By an universal law, indeed, whatever, whether fixed or movable, belongs to all men equally and in common, is the property for the moment of him who occupies it, but when he relinquishes the occupation, the property goes with it. Stable ownership is the gift of social law, and is given late in the progress of society... Society may give an exclusive right to the profits arising from [ideas], as an encouragement to men to pursue ideas which may produce utility, but this may or may not be done, according to the will and convenience of the society, without claim or complaint from anybody. Accordingly, it is a fact, as far as I am informed, that England was, until we copied her, the only country on earth which ever, by a general law, gave a legal right to the exclusive use of an idea. In some other countries it is sometimes done, in a great case, and by a special and personal act, but, generally speaking, other nations have thought that these monopolies produce more embarrassment than advantage to society; and it may be observed that the nations which refuse monopolies of invention, are as fruitful as England in new and useful devices." ~Thomas Jefferson, letter to Isaac McPherson, 13 Aug. 1813
The goal was to encourage innovation. I don't disagree at all that the goal was regulatory-captured in a significant way by rentiers, but its purpose is, counterintuitively, to incentivize pushing ideas out into the light.
This is a good illustration of what I call a “backward legitimization attempt”: you quote a letter that comes from ONE CENTURY after copyright was introduced.
And by the way, the Statute of Anne, was actually introduced as a way to end publisher's monopoly and create the public domain after a short period (14 years), how ironic.
One is ripping out a technical inner working from a website and using that to create your own.
The other is just making a directory of where to find things that are intentionally publicly available
Physical vs. digital. It's not stealing, it might be copyright infringement.
You say that you or your employer would be sued if you did this. Going through a legal battle over some copied HTML, CSS & JavaScript is expensive, distracting and time consuming. You'd first get a cease and desist letter. Who has the time or energy to sue over this?
Getting your work pulled off the internet against your will. How would that happen? Have you heard of the pirate bay? There's no off-switch because you used someones react component.
You might not like this tool or feel it facilitates behavior you consider unethical, and I get that, but these claims you made are absurd.
Very familiar with TPB. Their founders did time for their involvement. I've also sent DMCA notices and had content pulled from services, even a domain pulled by its host because the owner ignored the notice. You absolutely can take extraordinary steps to work around it but you know... Maybe just write your own components?
I've no opinion on this tool. It's a tool, like a text editor or View Source. I'm posting because of what people are suggesting doing with it.
Your original comment stated, as fact, "you'll get yourself or your employer sued, and/or your work pulled off the internet against your will."
You're right that suits do happen, and while there is a grain of truth in what you said, stating it the way you did is just too bold in my opinion. I highly doubt the individual developer would be sued. How would a company seeking damages know who made the git commit so they could target the developer?
The clarification in your reply about copying being willful, profitable and profit-damaging is where things start to make sense. And if you had said something along the lines of that, I wouldn't have replied and would have found myself in agreement.
Once upon a time devs cared about this sort of thing. Living through the '90s and then now... where devs just pick the default license (MIT?) that github puts on a repo is crazy. There is this cultural assumption today that everything is just a public domain free-for-all.
Just like you somehow restrain yourself from photographing someone else's picture and then selling it.
But screenshotting and reselling peoples NFTs is one of my favorite hobbies.
We still compile our TS to an ES5 target with bootstrap. If you copied a form from our site into the tool, it would be hard for us to tell you took it from us rather than writing it yourself. Maybe if you took some of our more custom card designs, but really, we wouldn’t know that you didn’t just design them yourself similar to how we did because you had the same issues.
if the code is not available, very likely you will not have permission to use it.
Don't see a legal usage of this kind of tool in a commercial context. Pretty useful as a learning too though
After all, it is currently the nature of web software that the source code must be available (for browsers to interpret)
Is this limited to React sites, or any HTML page?
What happens if the target website uses a react component library (like mui)?
I guess for some use cases it could still be useful to extract just a portion of that code. But in other scenarios it might be cleaner to just use that component library.
But it is a bit misleading to say it will copy a component. Components are more than HTML/CSS.
Maybe rephrase it in "templating" ?
Itd be possible to build a React app that has very little React code in it, but it'd also be weird.
[1]: https://huu.la
Addendum: Figured I should give it a try because I think the idea has promise. But I tried this on three sites, a regular js site, a next.js site and a CRA site. Each time tried to do a 'Copy React' op on a button, and each time I just got back html.
1) Your explainer "Copy React code from any website" implies that I'm copying the react code from a website. What you are doing is copying the html/css of a website and then exporting it to an autogenerated react component(s).
2) It would be great if the demo video showed the React component generated. Is all of the html thrown into 1 component? Is the resulting html clean? Or is it cluttered with html attributes that aren't actually needed?
If this could be combined with tooling to facilitate the use of generated code to more easily produce React Native compliant versions, giving you a quicker path to iOS and Android equivalents, you would be halfway to auto-generating what 90% of non-technical people want when they say "just build me something like X site/app".
It's really just a specialized Copilot at that point.
It seems fine for simple mocks/POC type stuff.