|
dupersaurus posted:Markdown? This gave me an interesting idea and I think serves for my needs without using another library to parse. Thought I'd share. A post's content could look like: code:
code:
|
# ? Sep 22, 2018 16:48 |
|
|
# ? May 19, 2024 04:20 |
|
huhu posted:This gave me an interesting idea and I think serves for my needs without using another library to parse. Thought I'd share.
|
# ? Sep 22, 2018 17:58 |
|
Lumpy posted:The only issue with this is that you may eventually be asked to add support for lists, multiple headline styles, etc. And then you've just reinvented Markdown with a less well tested parser. It's my project so I don't aim to ask that of myself. All I wanted was headers, text, and images.
|
# ? Sep 22, 2018 18:11 |
|
Lumpy posted:The only issue with this is that you may eventually be asked to add support for lists, multiple headline styles, etc. And then you've just reinvented Markdown with a less well tested parser. The 2nd problem is regex. Esp this line: const [tag, content] = line.split(/#(.+)/) What happens with #hashtags in your content? Or a URL that has a # in it because reasons? code:
|
# ? Sep 22, 2018 20:59 |
|
geeves posted:The 2nd problem is regex. Another question. I've got an App.js structured like this: code:
code:
code:
|
# ? Sep 23, 2018 15:49 |
|
huhu posted:Thanks for catching this! Go check out the react router docs, I don’t remember what it is but I’m pretty sure they have something for exactly that.
|
# ? Sep 23, 2018 16:26 |
|
Is there a way to leave a javascript file out of Webpack 4's bundler, for use as a separate, editable config? Ie I have a .ts file (Could as easily be JS) that contains simple arrays of values, similar to JSON). I'd like to be able to edit that file separately from the bundle, and have the changes take effect immediately without transpiling. I suspect the solution involves a tweak to webpack.config.js .
|
# ? Sep 24, 2018 22:00 |
|
Dominoes posted:Is there a way to leave a javascript file out of Webpack 4's bundler, for use as a separate, editable config? Ie I have a .ts file (Could as easily be JS) that contains simple arrays of values, similar to JSON). I'd like to be able to edit that file separately from the bundle, and have the changes take effect immediately without transpiling. I suspect the solution involves a tweak to webpack.config.js . Perhaps this? https://stackoverflow.com/questions/44376589/webpack-exclude-a-specific-file
|
# ? Sep 25, 2018 03:48 |
|
I'm learning React and I'm creating an absolute horror on my own here. I'm trying to implement toggleable options, or settings. These options can be grouped in a option category, e.g.: pre:Frobnication foo bar baz So I have an OptionCategory component as well as an Option component. Looking at the React tutorial, I should "lift state up" (https://reactjs.org/docs/lifting-state-up.html) here so that the OptionCategory holds the state for all the suboptions. Where my needs differ from what's shown in the example in the tutorial however, is that I don't necessarily know what options are going to be in the category ahead of time. If I use composition and use this.props.children in the render function of the category, I can't then control the props of the children from within the category to enable/disable the options (they are immutable). Additionally, if a category is enabled, but all the suboptions are disabled by the user, the category should become disabled too. Likewise, if a category is disabled but a user enables a suboption, it should become enabled. How can the children components cause a change in state of the parent category? They aren't even aware the parent exists. e: post is not preview ArcticZombie fucked around with this message at 21:38 on Sep 26, 2018 |
# ? Sep 26, 2018 21:29 |
|
ArcticZombie posted:I'm learning React and I'm creating an absolute horror on my own here. Have your parent pass closure functions to change the parent state to the children as props.
|
# ? Sep 26, 2018 21:45 |
|
Ahz posted:Have your parent pass closure functions to change the parent state to the children as props. But if I'm using composition: code:
|
# ? Sep 26, 2018 21:57 |
|
Has anyone successfully mixed Python HTML templates (jinja2/etc) with React? I'm making login and registration pages for my React SPA and it would really help to leverage flask_wtf forms. Currently I have a janky setup where Flask templates set window variables in index.html before I call the React <script>s which use dangerouslySetInnerHTML, and that's clearly stupid. Broadly, this is about how you mix server-side HTML templating with React JS code. If it's better to learn server-side React stuff then I could do that.
|
# ? Sep 27, 2018 00:22 |
|
ArcticZombie: Group all settings in a single object, to make passing to subcomponents cleaner.JavaScript code:
JavaScript code:
JavaScript code:
Dominoes fucked around with this message at 02:32 on Sep 27, 2018 |
# ? Sep 27, 2018 00:34 |
|
Do y'all know if it's possible to run frontend apps that use WASM from local HTML files, ie without a server? It's working in Edge for me, but in FF I get the error: "TypeError: Response has unsupported MIME type", and in Chrome: "Fetch API cannot load file:///C:/...module.wasm. URL scheme must be "http" or "https" for CORS request." I suspect this isn't supported in most browsers; my use-case is running an app at work, where I can't install a server. Was hoping to move parts of the code to Rust. The page loads, but the WASM-content doesn't. (Except in Edge) Dominoes fucked around with this message at 05:52 on Sep 27, 2018 |
# ? Sep 27, 2018 05:50 |
|
ArcticZombie posted:But if I'm using composition: Hoist the state further: code:
|
# ? Sep 27, 2018 07:41 |
|
Dominoes posted:Do y'all know if it's possible to run frontend apps that use WASM from local HTML files, ie without a server? It's working in Edge for me, but in FF I get the error: "TypeError: Response has unsupported MIME type", and in Chrome: "Fetch API cannot load file:///C:/...module.wasm. URL scheme must be "http" or "https" for CORS request." I think this might work as a browser extension rather than a local URL even though it's not HTTP or HTTPS. I did something similar (not WebAssembly) a few years ago and it worked in Chrome, but not Firefox (or Safari) at the time. However that was before Firefox adopted web extensions fully so cross-origin support in extensions could be supported better now.
|
# ? Sep 27, 2018 13:26 |
|
spacebard posted:I think this might work as a browser extension rather than a local URL even though it's not HTTP or HTTPS. I did something similar (not WebAssembly) a few years ago and it worked in Chrome, but not Firefox (or Safari) at the time. However that was before Firefox adopted web extensions fully so cross-origin support in extensions could be supported better now.
|
# ? Sep 27, 2018 15:30 |
|
I'm giving my first lightning talk at my JS meetup next Tuesday and I am nervous and excited! The imposter syndrome never goes away does it. Its about trying out GraphQL with existing REST APIs so I hope folks like that. Do y'all have JS or webdev meetup groups that are good? I find ours very valuable and enjoyable.
|
# ? Sep 27, 2018 22:26 |
|
I know if I was allowed to talk for a period of time I'd start talking about RxJS and wouldn't shut up.
|
# ? Sep 27, 2018 23:05 |
|
I'll never understand how people get so passionate about RxJS. The documentation is such poo poo and it's near impossible to learn when you first start using it
|
# ? Sep 28, 2018 00:25 |
|
Grump posted:I'll never understand how people get so passionate about RxJS. The documentation is such poo poo and it's near impossible to learn when you first start using it People get excited about the FRP paradigm that RxJS implements. It lets you implement complex UI logic with small, elegant functions. I agree the documentation could be better. Sometimes the main description of an operator appears to a novice as essentially word salad, like "Frob takes two observables and emits a single observable that emits a new observable for every observable that the original two observables emit." Many a time I've read the description of some operator and felt like I've come away with less information than I had when all I knew was the name. For me looking at the marble diagrams is usually the best way to get a feel for what an operator does. http://rxmarbles.com/ is a great resource for that. However, I think the part about it being hard to learn is sort of unavoidable. It's a pretty different way of thinking about programming, and most people have little previous experience with it. You should think of it as akin to learning OOP, or like learning functional programming in general. Learning that poo poo takes years, but it's worth it.
|
# ? Sep 28, 2018 09:54 |
|
LOOK I AM A TURTLE posted:People get excited about the FRP paradigm that RxJS implements. It lets you implement complex UI logic with small, elegant functions. That's why I learned Elm. Good docs and like you said, that "other way of thinking" is really worth exploring.
|
# ? Sep 28, 2018 14:01 |
|
I have a long list of complicated objects that I'm trying to render in groups with sub-groups (and also multiple, different sbu-sub-groups on the same line) in React. To make whole sub-groups selectable, my vurry clevar idea was to docode:
I tried to solve that problem by changing the checked condition to {!!this.props.selectedItems[group[0].Id]} so it's always true or false instead of true or undefined. That prevents the inputs from rendering as checked when clicked, even though the reducer runs as expected and the mapping is set. I put a breakpoint on the line that renders the table row and it never runs and something (presumably React's event handler wrapper clears the check when I click on it. How do I make this work? e: calling this.forceUpdate() in the handler is a bandaid, but this thing takes two seconds to render, so I really need to slice this up into components Munkeymon fucked around with this message at 19:10 on Sep 28, 2018 |
# ? Sep 28, 2018 18:00 |
|
Grump posted:I'll never understand how people get so passionate about RxJS. The documentation is such poo poo and it's near impossible to learn when you first start using it I'm not going to lie and tell you the Observable model wasn't just the most mysterious poo poo I've ever seen when I saw it and I still need to cross-reference my other examples of it when I go to write it but it's baller and I love it.
|
# ? Sep 28, 2018 21:33 |
|
Munkeymon posted:I have a long list of complicated objects that I'm trying to render in groups with sub-groups (and also multiple, different sbu-sub-groups on the same line) in React. To make whole sub-groups selectable, my vurry clevar idea was to do Ouch. My guess is "group" is the stickler, but seeing a lone snippet of JSX makes it hard to figure out what the problem could be.
|
# ? Sep 28, 2018 22:05 |
|
Lumpy posted:Ouch. My guess is "group" is the stickler, but seeing a lone snippet of JSX makes it hard to figure out what the problem could be. What other context do you need? Reducers look like JavaScript code:
|
# ? Oct 1, 2018 15:09 |
|
Munkeymon posted:What other context do you need? Reducers look like Just to double check: - You've looked at the Redux dev tools and seen the action w/ the correct payload and noticed the state diff? Also, I suspect this: JavaScript code:
JavaScript code:
EDIT: Or alternately create a copy of selected items in your functions like so: JavaScript code:
Lumpy fucked around with this message at 14:05 on Oct 3, 2018 |
# ? Oct 3, 2018 14:02 |
|
Lumpy posted:Just to double check: The Redux dev tools exhaust memory and I have to close the inspector and reload the page if I try to use them, so I've been debugging with breakpoints like a caveman, but you're correct and changing the assignment to const selectedItems = { ...state.selectedItems }; corrected it, so I can probably change my deselect reducer to just not copy across the deselected properties. Munkeymon fucked around with this message at 14:24 on Oct 3, 2018 |
# ? Oct 3, 2018 14:16 |
|
If I know a DOM subtree can be affected by this global state, but often won't be and I know when it will and won't be, that's a good time to split that subtree out into a (not sure of the right jargon for the following) high-level component with its own reducers and whatnot, right?
|
# ? Oct 3, 2018 16:29 |
|
Munkeymon posted:The Redux dev tools exhaust memory and I have to close the inspector and reload the page if I try to use them, so I've been debugging with breakpoints like a caveman, but you're correct and changing the assignment to const selectedItems = { ...state.selectedItems }; corrected it, so I can probably change my deselect reducer to just not copy across the deselected properties. I have a middleware that runs Object.freeze on everything that gets put into the store, to avoid issues like this. I turn it off in production, obviously.
|
# ? Oct 3, 2018 16:30 |
|
High level question for you guys. If you were starting a new SPA from scratch and you wanted to build it nice.. would you choose Vue.js or React? I personally loved Vue for its simplicity but I know React has the market share. And I know that counts for something because my last application was built with a fringe framework which no longer exists, and even though it was technically superior to say Spring MVC at the time, I wish I went with spring just because of the long lasting support and job potential. I know this is potentially an endless debate so I'm not looking for anything deep, just some points for me to think about.
|
# ? Oct 3, 2018 17:25 |
|
FateFree posted:High level question for you guys. If you were starting a new SPA from scratch and you wanted to build it nice.. would you choose Vue.js or React? I personally loved Vue for its simplicity but I know React has the market share. And I know that counts for something because my last application was built with a fringe framework which no longer exists, and even though it was technically superior to say Spring MVC at the time, I wish I went with spring just because of the long lasting support and job potential. Vue is gaining enough traction to where I see it on job postings at least once a week, so if you're worried about it disappearing like your previous framework, I don't think that will happen.
|
# ? Oct 3, 2018 17:33 |
|
FateFree posted:High level question for you guys. If you were starting a new SPA from scratch and you wanted to build it nice.. would you choose Vue.js or React? I personally loved Vue for its simplicity but I know React has the market share. And I know that counts for something because my last application was built with a fringe framework which no longer exists, and even though it was technically superior to say Spring MVC at the time, I wish I went with spring just because of the long lasting support and job potential. React. Mainly because I already know and really like React.
|
# ? Oct 3, 2018 17:40 |
|
Munkeymon posted:If I know a DOM subtree can be affected by this global state, but often won't be and I know when it will and won't be, that's a good time to split that subtree out into a (not sure of the right jargon for the following) high-level component with its own reducers and whatnot, right? Separate reducers are to keep logic separate: they still all populate a single global state object. If you have a component that has a lot of children and you want to avoid checking for re-renders you *may* want to use PureComponent or implement a componentShouldUpdate. I recommend reading this: https://reactjs.org/docs/optimizing-performance.html
|
# ? Oct 3, 2018 17:48 |
|
Lumpy posted:Separate reducers are to keep logic separate: they still all populate a single global state object. If you have a component that has a lot of children and you want to avoid checking for re-renders you *may* want to use PureComponent or implement a componentShouldUpdate. I recommend reading this: https://reactjs.org/docs/optimizing-performance.html Thanks!
|
# ? Oct 3, 2018 18:20 |
FateFree posted:High level question for you guys. If you were starting a new SPA from scratch and you wanted to build it nice.. would you choose Vue.js or React? I personally loved Vue for its simplicity but I know React has the market share. And I know that counts for something because my last application was built with a fringe framework which no longer exists, and even though it was technically superior to say Spring MVC at the time, I wish I went with spring just because of the long lasting support and job potential. Depends on your market. Locally I'm seeing _a lot_ more offers looking for React.
|
|
# ? Oct 3, 2018 18:27 |
|
I would choose React because I know it better, dislike directives in HTML, and because it plays better with GraphQL, in my experience.
|
# ? Oct 4, 2018 01:46 |
|
FateFree posted:High level question for you guys. If you were starting a new SPA from scratch and you wanted to build it nice.. would you choose Vue.js or React? I personally loved Vue for its simplicity but I know React has the market share. And I know that counts for something because my last application was built with a fringe framework which no longer exists, and even though it was technically superior to say Spring MVC at the time, I wish I went with spring just because of the long lasting support and job potential. I personally prefer React simply because it's tools and support are so great. I started looking at React from AngularJS a couple of years ago and going from Angular Dev Tools to React Dev Tools sold me on the entire framework. Create-React-App is simply unbeatable for most single-dev spare-time non-commercial apps. That said, Vue is definitely gaining traction. It's a good framework, and it came at a good time. It first started to come about as an alternative to React when the whole licensing fiasco happened(that has since been resolved), and it's only gotten more and more important from there. I have been looking at every job posting at a particular company I want to work at, and in the past 8 months Angular has dropped from their list of "if you know these frameworks, that's a big plus" entirely, and Vue has moved onto it.
|
# ? Oct 4, 2018 01:47 |
|
Tools and the whole framework of support surrounding a framework or technology are just as important to me as the technology itself. In fact, thats so important that there are many superior frameworks/technologies/paradigms (like Elm!) that I just don't use because of this.
|
# ? Oct 4, 2018 02:04 |
|
|
# ? May 19, 2024 04:20 |
|
Vincent Valentine posted:I personally prefer React simply because it's tools and support are so great. I started looking at React from AngularJS a couple of years ago and going from Angular Dev Tools to React Dev Tools sold me on the entire framework. Create-React-App is simply unbeatable for most single-dev spare-time non-commercial apps. I don't know how Angular is these days, but at least AngularJS vs React - React was more simplistic and pretty much a view upon which you could build with other tools once you needed them. AngularJS was here's 7 different ways of doing the same thing - have fun. Then back tracking and saying to use Directives or BindToController because that's the proper way. When Google then just abandoned the product then stupidly kept using Angular to much confusion just screams that it's a poorer product. (It might not be, but drat you'd think they'd be smarter about branding because it is important)
|
# ? Oct 4, 2018 03:29 |