r/reactjs • u/acemarke • Dec 04 '17
Beginner's Thread / Easy Questions (December 2017)
The last thread stayed open for about a month, so I guess we might as well make these monthly :)
Soo... Got questions about React or anything else in its ecosystem? Stuck making progress on your app? Ask away! We’re a friendly bunch. No question is too simple.
The Reactiflux chat channels on Discord are another great place to ask for help as well.
14
Upvotes
2
u/i_am_hyzerberg Dec 27 '17
Here goes, I was told no question was too simple. Short background, been a web dev for almost 10 years, have a lot of experience in the .net framework and knockout and jquery. Just finished my first React walkthrough (tic-tac-toe video on youtube).
So with React, at a high level, should state be compartmentalized down to each component, so like a one-to-one state object for a component? If so, do these typically correct to something like a web api route since those are pretty naturally crud based operations on an object by object basis per route? Also, it seems like there could be a great deal of complexity when you have components nested inside of components creating what could be a russian doll type paradigm of state objects. I'm just probing, trying to get an idea of best practices as a larger scale app is designed.
1
u/Light-headed Dec 04 '17
Anyone have some great tutorials for passing props from child to a siblings child? I can pass props between parent child and sibling but after that I keep running into errors. I'm not currently using redux or anything else. Thanks in advance.
1
u/hunterdavies Dec 31 '17
Hi there! I've made a few React and Redux apps using the create-react-app command. They are now finished locally, but I would like to host them just as a portfolio example on my Wordpress site. Can someone point me in the direction of how to do this? I've tried 'yarn build' but the file is empty, and also tried setting it up with Heroku but also empty..I'm doing something wrong, but not sure what. Thanks in advance
2
u/CodeKommissar Dec 06 '17
What would be good project ideas for someone learning React to put in their portfolios? Maybe you could tell what sort of projects did you have when you were hired as a React Developer.
Right now I just have a simple todo list app which uses localStorage to store the todos, but I want to make more complex projects. I've been thinking of making an Instagram client with React/Redux but after that, I don't know what should I do. Any ideas? Thanks in advance!
2
u/masonjwhite Dec 09 '17
Hey everyone! Really happy to be here. Excited to get involved in the community.
I’m a new JS dev and really enjoying myself. I don’t have a question, more of a “check if my understanding is correct” kind of situation.
I’m brand new to web apps and just want to make sure I have the big picture correct.
**For sake of using technologies I’m semi-familiar with, I’ll use the MERN stack with Redux
Appreciate any and all feedback!
Looking forward to getting to know you all!
2
u/mulvidon Dec 13 '17
I'm new to programming in general and am just finishing up school where I built a website in PHP/MySQL for my capstone project. However, in the last semester I had a class on React/Redux and I loved it and want to port my website over to it.
What technologies would I use and what adjustments to my thinking do I have to make coming from a PHP/MySQL background?
Thanks
1
u/lolcookie2 Dec 04 '17 edited Dec 04 '17
What is the easiest to get started component sandbox?
1
u/prove_it_with_math Dec 05 '17
I'm using
react-router-domfor routing/browser-history and I have the following code:How do I redirect user to
dashboardpage if the user is already authenticated?1
u/prove_it_with_math Dec 05 '17
Should I be saving user's token in Redux store or in sessionStorage or localStorage?
1
u/jackwilsdon Dec 06 '17
What should I be doing with data derived from my Flux stores?
1
u/SonicViewBob Dec 06 '17 edited Dec 06 '17
is there any way to pass the filter text to the grid for each column from several dropdowns on the page by using react-data-grid adazzle's? I read an adazzle's documentation and couldn't find anything references to such functionality
I'm looking for something close to ag-grid's Quick Filter, but for specific column for each dropdown.
is there any way to connect to on grid's filters and populate my separate dropdowns by jquery ?
1
u/EverAccelerating Dec 06 '17
How do I send an action from one component to another, especially if the components don't have a parent-child relationship?
A simplified version of my use case: I want to be able to click on a button in one component and have another component do some kind of animation. The components themselves are distant cousins, with a common great-grandparent.
This doesn't seem like something I'd do in Redux (or is it?). What is the paradigm for handling something like this?
1
u/fudgepop01 Dec 07 '17
hey! So I love javascript and everything you can do with different modules. I learned by coding a discord bot. Now, I'd like to learn react for web-application development, and I would like to eventually build up to the scale of an entire website built in react :o
However, I've found so many resources that could in-theory make things easier/more efficient - but so many resources online that tell me how to apply them and make them work together are out of date or something...
The things I want to incorporate into my react website are:
I can install the redux module and use that just fine, but learning how to install and utilize postcss has been giving me a bunch of trouble. As I said i've found many tutorials that appear to be outdated or use webpack/gulp which is another rabbit hole.
I guess what I'm asking is...
How do I implement postcss & redux in the environment that comes with [node create-react-app]?
1
u/Peng-Win Dec 08 '17
I have ~250k elements in a JSON array element. I'm trying to extract a particular key's value from each of the 250k elements, and join them together as comma-separated values.
As you can imagine, this is pretty slow ... anyway I can do this on a separate thread in React.js (not native)?
1
u/prove_it_with_math Dec 12 '17
I'm trying to disable a button unless if it meets the following criterion: user's name or age + height must be provided. This is what I have:
disables={ ( !this.state.name || !this.state.age ) && !this.state.height }. And it's not working. Once I type user'snameandagein the button is enabled. What am I doing wrong?Note: I'm updating object state via
setState.1
u/Gwouten Dec 12 '17
Hi,
I'm trying to show a message when over over the <options> of a <select> element, but nothing is happening for the moment...
Here is the code:
Is there something else I need to do?
Thanks!
1
u/vamsi_rao Dec 14 '17
Hi I was recently given a coding challenge to implement autosuggestions over a JSON array of 10000 items and I am using react to do it. As we use controlled component for input, it is taking large amount of time to show the typed letter in the input(its value is coming from state). I have successfully implemented the search but the duration of showing up of letters is something I am not able to get around. Any suggestions?
PS: the letter doesn't show up until results of autosuggestions are shown and the there's no network request involved in this, I have the list available locally
1
u/Kenpaachi Dec 15 '17
What Growl/Toastify u guys recommend ?
1
u/BlubbyMunkey Dec 15 '17
I'm having an issue with this line trying the get the browser's language so I can change the text displayed based on this info:
const userLanguage = window.navigator.language.substring(0,2) || window.navigator.userLanguage.substring(0,2);
This should be simple code to add, but my Visual Studio Code is throwing an error saying that navigator does not have a userLanguage property. I need this so it can grab the language for IE.
Could this be a typings thing, or am I missing something that will allow me to call this browser property on IE?
1
u/ifydav Dec 18 '17
I'm working on a side project and contemplating whether to implement a custom authentication system or a firebase authentication. Any ideas?
1
u/EverAccelerating Dec 18 '17
More of a best practices / standard practice / common pattern type of question.
If I have a component A that calls component B, and both A and B need the same item from the Redux state, should they both individually use
connect()/mapStateToProps()to the Redux store, or should A useconnect()to grab the item and pass it as a prop to B?Or more generally, should (unmodified) items in Redux ever be passed as props, or should any component that needs a state item grab it directly from Redux?
1
u/Agsiegert Dec 21 '17
What are some good videos for a mid-level developer coming from another programing language to learn React?
1
u/DULLKENT Dec 23 '17
Hi. I'm trying to make a simple financial tracking app. I have a component that contains an input field that when submitted, will add the entry to a list, which is rendered below. I've set it up so that there are two instances of this components - one for incoming and one for outgoing. I'm wondering what the best way would be to differentiate them so that they use different actions. This is what I've started to do:
In my app.js:
Then in the component:
Doing this just seems wrong as I'm repeating myself a lot. Is there a better way I should go about this? Thanks.
0
u/[deleted] Dec 24 '17
[deleted] — view deleted comment
0
u/[deleted] Dec 04 '17
[deleted] — view deleted comment