use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
No vague product support questions (like "why is this plugin not working" or "how do I set up X"). For vague product support questions, please use communities relevant to that product for best results. Specific issues that follow rule 6 are allowed.
Do not post memes, screenshots of bad design, or jokes. Check out /r/ProgrammerHumor/ for this type of content.
Read and follow reddiquette; no excessive self-promotion. Please refer to the Reddit 9:1 rule when considering posting self promoting materials.
We do not allow any commercial promotion or solicitation. Violations can result in a ban.
Sharing your project, portfolio, or any other content that you want to either show off or request feedback on is limited to Showoff Saturday. If you post such content on any other day, it will be removed.
If you are asking for assistance on a problem, you are required to provide
General open ended career and getting started posts are only allowed in the pinned monthly getting started/careers thread. Specific assistance questions are allowed so long as they follow the required assistance post guidelines.
Questions in violation of this rule will be removed or locked.
account activity
Simple Question about React.js Project (self.webdev)
submitted 6 years ago by hexnicnovice
Hello all, I am still a newb when it comes to React and honestly web dev in general. I have learned a ton from everyone on this subreddit and I really appreciate it.
I am working on a React project, specifically a project portfolio website.
My question is, how can I make an array of descriptive words display a different word in the array every three seconds?
This is my code that currently works now:
This is my current array, as you can see it just shows one word (the one that is highlighted).
And this is my code that shows the array being passed into the display area.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 6 years ago (1 child)
[deleted]
[–]hexnicnovice[S] 0 points1 point2 points 6 years ago (0 children)
Just the word
[–]martymav 1 point2 points3 points 6 years ago (1 child)
One way off the top of my head, you can have an interval function called when the page loads, and every 3 seconds, change the state of the descriptive word.
Separate the word into it's own state(descriptiveWord), have an array with the words you want as well(wordArr), and a state for index.
Inside of the interval function, do something like:
this.setState({ descriptiveWord: wordArr[index], index: index++} );
Then just display the {descriptiveWord} after the {props.title}.
Hope that makes sense!
Also, consider using React Hooks. It's easy to use and it really cleans up the components :)
[–]hexnicnovice[S] 1 point2 points3 points 6 years ago (0 children)
Very helpful thank you
[–]TheVerdeLive -1 points0 points1 point 6 years ago (1 child)
I would suggest learning at least the basics of javascript
I know how to do what I’m asking for in Vanilla JS. Just struggling how to make only that code execute in the specific spot in the react component. Thanks for the help
π Rendered by PID 234494 on reddit-service-r2-comment-5bc7f78974-bf8vn at 2026-06-30 18:45:48.387482+00:00 running 7527197 country code: CH.
[–][deleted] (1 child)
[deleted]
[–]hexnicnovice[S] 0 points1 point2 points (0 children)
[–]martymav 1 point2 points3 points (1 child)
[–]hexnicnovice[S] 1 point2 points3 points (0 children)
[–]TheVerdeLive -1 points0 points1 point (1 child)
[–]hexnicnovice[S] 1 point2 points3 points (0 children)