|
xiw posted:I'm having a real poo poo of a time getting into the kind of frontend development i'm being asked to do, which is things like customise Bigcommerce through JS injected scripts. It feels like an infinite nightmare of reading minified JS from thirdparties and trying to reverseengineer it and change behaviour. Is this actually a usual thing (hey this compiled JS does X, change it to do Y by intercepting mutators and hunting events and charting out its flow) or am i starting with the hard stuff? what the gently caress no, it isn't supposed to be like this at all im so sorry.
|
# ? Jun 23, 2020 10:36 |
|
|
# ? Jun 6, 2024 02:37 |
|
xiw posted:I'm having a real poo poo of a time getting into the kind of frontend development i'm being asked to do, which is things like customise Bigcommerce through JS injected scripts. It feels like an infinite nightmare of reading minified JS from thirdparties and trying to reverseengineer it and change behaviour. Is this actually a usual thing (hey this compiled JS does X, change it to do Y by intercepting mutators and hunting events and charting out its flow) or am i starting with the hard stuff? i've never heard of anyone doing it like this. either you're missing something about a debug mode or your lead is evil.
|
# ? Jun 23, 2020 13:37 |
|
*
gamer roomie is 41 fucked around with this message at 15:36 on Jul 17, 2020 |
# ? Jun 23, 2020 16:15 |
|
i dont really get what you're asking, what validation errors? and stupid qustion but have you tried <br/> if you want to make sure its not being read as html then you need to make sure whatever you're outputting is being treated as a string. you can try replacing < with < and > with > (html entities) or you can modify however you're making the JSON go in wherever it is you're making it go. not having visibility there makes it hard to give a suggestion though
|
# ? Jun 23, 2020 16:28 |
|
gamer roomie is 41 posted:If there is a <br> tag in JSON, how do I keep it but not have it cause a formatting error, or have it actually read as a line break?
|
# ? Jun 23, 2020 16:29 |
|
yeah disregard mine. the way you have it should work. from devtools in a mozilla new tab... code:
|
# ? Jun 23, 2020 16:31 |
|
*
gamer roomie is 41 fucked around with this message at 15:36 on Jul 17, 2020 |
# ? Jun 23, 2020 17:12 |
|
gamer roomie is 41 posted:Thanks gang. This is new to me so the help articles and stack overflow answers go way over my head, as they presume some knowledge. There are ways of inserting html in a page and having it work, but I feel like the error is probably resulting from some kind of js based HTML sanitizer, and throwing an exception if you try to use unsafe text - there are different approaches that HTML sanitizers can use, but the context you're getting the error message in is unclear (e.g. is this a react app, angular app, some kind of custom code.) In principle you wouldn't get this message with a pure html/js message so it's likely coming from some kind of framework or custom js that is trying to protect you from yourself. The control may be expecting the text to be escaped or something, but the specifics would depend on the implementation.
|
# ? Jun 23, 2020 17:49 |
|
yeah what frameworks *are* you using?
|
# ? Jun 23, 2020 17:51 |
|
Osmosisch posted:Look into webpack. Wheany posted:Seconding webpack. The tutorial/getting started on the official website is pretty good too. Once you get the project structure mostly there, you can start adding plugins to the mix Thanks guys, it's pretty much exactly what I'm looking for. One more question. I'm making a bookmarklet and want to use webpack to insert the bookmarklet into a html page. I don't really understand half the stuff I read so am probably missing something obvious, but most things I've found are great tutorials or plugins that create a bookmarklet but then say something like, then you copy and paste the javascript into the bookmarklet. I don't want to be copying and pasting that javascript into a bookmarklet or html file, I just want to inline the javascript into the a source html file. I've found plugins that inline the scripts in <script> tags but I want to use a link tag to make a bookmarklet. Here is a simple example of what I want. Source bookmarklet.js code:
code:
code:
|
# ? Jun 23, 2020 20:23 |
|
Hello thread I want to increase my knowledge of React but I can't think of any simple things to build to learn... Any suggestions+
|
# ? Jun 23, 2020 20:34 |
|
Empress Brosephine posted:Hello thread I want to increase my knowledge of React but I can't think of any simple things to build to learn... A suggestion/idea tracker Use local storage if you don’t want to do any backend stuff Suggested features: A list view and a detail view List view filter options based on attributes of the idea Add and delete buttons The ability to reorder items Up/down voting items Comments
|
# ? Jun 23, 2020 21:28 |
|
if you work with wordpress you can try to 1:1 a react app with wordpress frontend, all of the content is exposed as json by default these days, just graphql into that poo poo and away you go.
|
# ? Jun 23, 2020 21:33 |
|
should say not 1:1, it should be a marked improvement in terms of smoothness & usability in the frontend and the scalability in your code base otherwise its a waste of time lol
|
# ? Jun 23, 2020 21:35 |
|
Thanks for the help. I wanna try that WordPress thing because the bulk of the work I do is on WordPress and I hate it.
|
# ? Jun 23, 2020 22:36 |
|
Same
|
# ? Jun 23, 2020 22:41 |
|
For React stuff, I can't recommend Next.js highly enough. It's a tiny bit more setup work than create-react-app but is even better at making all the fiddly bullshit just Go Away. Make some React components in a folder tree and run next export and it will generate a full static build for you that already includes routing, efficient code-splitting, and all that other stuff that you now don't really have to think about.
|
# ? Jun 23, 2020 22:48 |
|
Oh Woah thank you that sounds excellent
|
# ? Jun 23, 2020 22:49 |
|
I'm still really early into learning and haven't gotten to routes yet but the one time I experienced it they were horrible. I'll try next though that sounds nice.
|
# ? Jun 23, 2020 22:54 |
|
Empress Brosephine posted:Hello thread I want to increase my knowledge of React but I can't think of any simple things to build to learn... I wrote a long form tutorial on making a flashcard app using React, TypeScript, Jest, and React Testing Library: It's here on dev.to
|
# ? Jun 23, 2020 23:08 |
|
Awesome. Thanks looking forward to trying it out
|
# ? Jun 23, 2020 23:14 |
|
everytime i talk about react someone tells me to just use vue. i haven't used vue yet, but is it that much better?
|
# ? Jun 24, 2020 02:58 |
|
Vue is easier, and also easier to shoot yourself in the foot with. React can be statically analyzed in a way that's just not really possible with Vue because of fundamental design differences.
|
# ? Jun 24, 2020 03:12 |
|
React is really nice once you get the hang of it. It's well supported, the documentation is good, and you can do a lot with it. Plus the development in the last couple years has made it really easy and fast to write good, reusable code. But there's big drama cause a lot of the react team left facebook this month over facebooks policies about platforming racists. So we'll see what effect that has.
|
# ? Jun 24, 2020 07:39 |
|
Roadie posted:For React stuff, I can't recommend Next.js highly enough. It's a tiny bit more setup work than create-react-app but is even better at making all the fiddly bullshit just Go Away. Make some React components in a folder tree and run next export and it will generate a full static build for you that already includes routing, efficient code-splitting, and all that other stuff that you now don't really have to think about. Is that a Gatsby-like thing?
|
# ? Jun 26, 2020 01:55 |
|
albany academy posted:everytime i talk about react someone tells me to just use vue. i haven't used vue yet, but is it that much better? I like it a lot. For a personal project I would definitely prefer it, I find it easier to use and better structured than react. But either because I'm wrong, or a lot of people just haven't tried it, I don't seem to be in the majority. They're both doing essentially the same thing.
|
# ? Jun 26, 2020 08:03 |
|
Lumpy posted:Is that a Gatsby-like thing? It's a React framework that handles routing, server-side rendering, bundling (no need to deal with Webpack) and a bunch of other stuff in a very intuitive and pain-free way, with most of it happening with no configuration needed just by making component files at given paths. Nolgthorn posted:I like it a lot. For a personal project I would definitely prefer it, I find it easier to use and better structured than react. But either because I'm wrong, or a lot of people just haven't tried it, I don't seem to be in the majority. The main thing that you're missing is that if you go pure React, you can load up to the gills on static analysis tooling that's only practical because of the React approach of the code and the view template being the same thing. It makes proactive bug-checking much easier. Roadie fucked around with this message at 08:11 on Jun 26, 2020 |
# ? Jun 26, 2020 08:09 |
|
I don't really understand that. Vue also has single file modules if that's what you mean. You can do that fancy CSS/js/html in the same file thing if you want to.
|
# ? Jun 26, 2020 08:24 |
|
Roadie posted:It's a React framework that handles routing, server-side rendering, bundling (no need to deal with Webpack) and a bunch of other stuff in a very intuitive and pain-free way, with most of it happening with no configuration needed just by making component files at given paths. Ahh, cool. I will have to check it out!
|
# ? Jun 26, 2020 17:52 |
|
Nolgthorn posted:I don't really understand that. It's the difference between HTML code:
JavaScript code:
JavaScript code:
Roadie fucked around with this message at 01:49 on Jun 27, 2020 |
# ? Jun 27, 2020 01:47 |
|
That's some confusing and ugly boilerplate. I've got used to the webcomponent angle,JavaScript code:
|
# ? Jun 27, 2020 02:41 |
|
MrMoo posted:That's some confusing and ugly boilerplate. I've got used to the webcomponent angle, You can do this too in React: code:
Roadie fucked around with this message at 04:16 on Jun 27, 2020 |
# ? Jun 27, 2020 04:13 |
|
After working in React for 2.5 years, and then Vue for the past 6 months, I'll say this. There's a few definitive reasons I don't like Vue * There's not nearly as many stackoverflow answers around the tooling and other compatible libs, which can add hours to my troubleshooting process * two-way (but also compatible with one-way) data binding is confusing and i hate it, and having to support both when creating your own abstracted components is a PITA * you can't control the conditions for when a component re-renders
|
# ? Jun 27, 2020 04:25 |
|
Roadie posted:...and while the hooks version is better for general class-lifecycle-management-causes-a-lot-of-pain-in-the-long-run-that-takes-too-long-to-explain-to-fit-into-this-margin reasons, the class-based React version is still better than the WebComponents equivalent because you can't do type-checking and all that stuff on a template string using existing tooling. I think that’s what Typescript brings, for which LitHtml has full support for.
|
# ? Jun 27, 2020 14:28 |
|
I don’t have a lot to add to this conversation except that React functional components + hooks + typescript is super pleasant to work with
|
# ? Jun 27, 2020 18:17 |
The Fool posted:I don’t have a lot to add to this conversation except that React functional components + hooks + typescript is super pleasant to work with Amen. I love it.
|
|
# ? Jun 27, 2020 18:24 |
|
I'm trying to do learn some typescript client-side development, but I can't figure out the module system (I don't have much experience with client-side or typescript in general so pretend I know nothing). Let's say I have a simple hello world app that I broke into two files just so to use importing: foo.ts code:
code:
The error I'm getting is "Failed to load resource: the server responded with a status of 404 (Not Found)" for the "bar" file. It's trying to import './bar' when it should be importing from './bar.js' file. Manually going into the generated foo.js file and changing the import to 'bar.js' makes it work, but is there a way to configure the tsconfig to automatically add the '.js'? Am I even doing this the right way? Here is my tsconfig.json which I don't really have any idea what is going on code:
edit2: nevermind, I put the js extension in the import statements in the .ts files and it worked lol drainpipe fucked around with this message at 02:28 on Jun 28, 2020 |
# ? Jun 28, 2020 01:02 |
|
drainpipe, if you don't feel like writing file extensions, you can do this (assuming you're using babel for transpiling code):code:
JavaScript code:
JavaScript code:
JavaScript code:
|
# ? Jun 28, 2020 04:40 |
|
The Fool posted:I don’t have a lot to add to this conversation except that React functional components + hooks + typescript is super pleasant to work with I took far to long to get on the Typescript train, but I’m loving it, and hooks made the already wonderful React drat near perfect.
|
# ? Jun 28, 2020 15:27 |
|
|
# ? Jun 6, 2024 02:37 |
|
Grump posted:drainpipe, if you don't feel like writing file extensions, you can do this (assuming you're using babel for transpiling code): Thanks, but I'm using the vanilla tsc, not babel. I'm not familiar with the javascript/node environment, and all the tools is honestly kinda overwhelming. I had read that Webpack was also something I could have used for this. Is there a tldr rundown of all these tools?
|
# ? Jun 28, 2020 18:11 |