I was watching a Pluralsight course on React and the instructor stated that props should not be changed. I’m now reading an article (uberVU/react-guide) on props vs. state and it says Both props and state changes trigger a render update. Later in the article it says: Props (short for properties) are a Component’s configuration, its options if you may. They
Tag: reactjs
Implement Facebook API login with reactjs
I’m working on using Facebook’s Javascript SDK for authentication. I’ve been able to import the SDK properly and put a Like button on my page. But, the facebook login button has to be wrapped in the …
how to render multiple children without JSX
How to write this without using JSX? This comes from the react.js tutorial: http://facebook.github.io/react/docs/tutorial.html I know I can do the following: But this only adds one element. How can I add more next to one another. Answer You can use the online Babel REPL (https://babeljs.io/repl/) as a quick way to convert little chunks of JSX […]
react.js: removing a component
I’m fairly new at react.js, so any help is greatly appreciated. I have this: https://jsfiddle.net/rzjyhf91/ Wherein I have made 2 components: an image and a button. The goal is to remove the image …
Exchanging events between React components
I’m making a Chrome extension that inserts 2 different React extensions on to the page. I’d like to keep each of them in sync by sending the 2nd one an event with appropriate data when something else is selected in the first one. Is there a best practice when it comes to sending events to other components? I tried this
How to listen state changes in react.js?
What is the angular’s $watch function equivalent in React.js? I want to listen state changes and call a function like getSearchResults(). Answer I haven’t used Angular, but reading the link above, it seems that you’re trying to code for something that you don’t need to handle. You make changes to state in your React component hierarchy (via this.setState()) and React
Issue accessing state inside setInterval in React.js
I am trying to access the state of a component inside a setInterval in this way but it’s not working: componentDidMount: function() { setInterval(function() { console.log(this.state); },…
Call multiple functions onClick ReactJS
I know in vanilla js, we can do onclick=”f1();f2()” What would be the equivalent for making two function calls onClick in ReactJS? I know calling one function is like this: onClick={f1}