var parser = new DOMParser (); var doc = parser.parseFromString (response.responseText, "text/html"); var name = doc.flashvars.name; console.log(name);
@corvid Not exactly React, but JSX does help with providing a standard for creating elements, and it does warn you if you try to add invalid attributes to elements, etc. Useful warnings in that regards, but React's purpose isn't really about creating less errors.
Any of you guys ever use bookshelf-modelbase? I'm having trouble figuring out how to call its "update" function from a function I added myself. I feel like it's a dumb problem, I just can't figure it out. stackoverflow.com/questions/41064663/…
@Luggage It's a thing that seems theoretically useful: npmjs.com/package/bookshelf-modelbase, adds findOne, findAll, update, and a bunch of other boilerplate basic stuff.
It doesn't add much, just a little. Still, usefulness aside, the problem seems to boil down to a basic thing where I don't know how to call functions added to a previously extended model.
Meteor is so weird. I go to my dashboard: Mongo returns 1 user. I go to the admin dashboard, then back to the normal dashboard, mongo returns 5 users, then runs again and returns 1 user again
@Luggage Oh wait, it looks like they add update and such through the second parameter to bookshelf's extend, so I guess they are class methods and not instance methods. That's where I'm going wrong I think.
I don't quite understand what node.js is. Some sites seem to imply that you can just use node.js as an extension of sorts alongside your IDE to be a type of runtime resource manager. Other sites seem to indicate that node.js is a competitor of PHP, python, or ruby. Still others seem to indicate it can serve the same role as IIS or Apache. Are they all right, one of them, none of them?
@Abhishrek You may also have luck with jupyter (which is ipython) + its node backend. Never tried it, can't say how good it is, but ipython's pretty good, so
@Alex Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
@Luggage pretty evenly familiar with LAMP systems prior to OOP PHP, and recently (what I'm trying to figure this out for) is MS stack (Visual Studio, C#/ASP.NET/Web API, IIS, Sql Server)
I wanted to disable the submit button in a contact form (using Contact Form 7 plugin in WordPress). The button should be disabled from start and it would activate when all required fields are filled. Any idea how I can do this?
@Luggage Ah, easy fix. I just use Bookshelf's save instead. I knew it was something noob. It's sort of clear in retrospect re-reading the modelbase docs.
@Luggage I mainly ask because it seems like many MS stack users that implement reactJS do so via MVC with razor syntax, and I was wondering if an app that consisted of almost exclusively AJAX calls would still fit into the reactJS paradigm
@Luggage thanks a bunch man believe it or not the last 5 minutes of information was extremely difficult to find coherently on google (at least for me)
Now you had mentioned that if I'm trying to use reactJS but not have it on the server-side that my front-end environment should be pretty standard. In this instance, what would "standard" be?
Ok. .pipe(gulp.dest('.')) generates index.html at the same directory where i gulp file exists. I want to generate in some other folder with custom name. (like test.html)
Then, this is what I would do: Make a React SPA all on it's own. No Razor. IIS can hand out the static JS files that you have fromt hat and pass the webAPI calls to c#
If you can afford to load for 1-3 seconds, just when you push a new update, then a SPA is basically like a local application that just talk to the server for data.
@Luggage that's a good way of thinking about it. Here's what makes me think I might not want it... The application's front page acts as a dashboard showcasing information largely irrelevant to the purpose of the application.
This is for our maintenance workers, and currently it shows them app-related notifications, work orders from our ticketing system, and calendar events pulled through exchange web services.
@Luggage oh, duh! That would work well, I actually have been writing the front page out using vanilla JS just so I could establish the data connections to those secondary sources displayed in the dashboard.
@Luggage I'm in agreement about server-generated HTML, but if my current applications are setup in this exact way (C#, Web API endpoints) except that instead of using reactJS I use vanilla JS classes that handle all those intracacies as well, it really seems like I'm not getting a whole bunch of benefits.
I have used Razor for years. It's a decent templating language for C#, but.. I have moved on to all JS. Why make some html in C#< then modify in JS? Why use two languages for that one task?
So you are trying to do everythign by hand, from scratch, is JS? no wonder you get 'no benefits'.
same thing as doing it all in C# without using any pre-made libaries.
@Luggage I like it too, but a lot of the granularity that you're talking about is easily achievable the way I get the data. I retrieve it as "object" object is passed as params object to class. Class is instantiated with object properties. If I need to print the print function has eventListeners for everything that might need to be done and updates the object itself. When looking to update the server I can just check those objects that have updated instead of sending them all
Now I can see the benefit of JSX in this scenario, because this code:
function printWorkOrder(item) {
var work_order = document.createElement("div");
work_order.classList.add("workorder");
work_order.setAttribute("data-ID", item.ID);
var item_title = document.createElement("div");
item_title.classList.add("title");
item_title.innerHTML = item.title;
var item_info = document.createElement("div");
@Luggage Thanks man. I gotta go for lunch, but I appreciate the help. I guess my learning style is "argumentative" but it's just I have so many incorrect preconceptions that I almost need you to directly refute them to move past them.
@Vap0r what I am demoing there, is that instead of just modifying the contents on fo div, it actually re-renders the WHOLE thing when the "showMore" value is changed. React is smart enough to only change the one div (and button text), but you don't do that, you write ONE render function that accounts for ALL cases.