This is involving javascript using react. The problem is to pass 2 variables of data from a parent component to a child component. Pass these two variables to the child component: user1 = "admin@email.org", user2 = "cust@email.org".
-----------------Parent.js-----------------
import React from "react";
import ReactDOM from "react-dom";
import GuestApp from "./GuestApp";
class App extends React.Component {
constructor(props) {
super(props); // Must call
this.state = {role: "admin"};
}
render() {
switch (this.state.role) {
case 'guest':
return <GuestApp /* Insert the passing data in here */ />;
break;
}
}
}
ReactDOM.render(<App />,
document.getElementById("root"));
-----------------Child.js-----------------
import React from "react";
class GuestApp extends React.Component
{
constructor(props)
{
super(props); // Must call
this.state = {show: "home"};
}
render()
{
/* Insert any code here as needed to accept the passed down
information from parent.js */
}
}
Modify the parent and child files as needed to pass down
the information from parent to child. Need not worry about any
component rendering or anything else. This exercise is only to
correctly pass information down.
We can do this in multiple ways but here I have passed it down as a prop and the used it using object destructuring. My code is below.
This is the parent component
This is the child component.
I hope you liked it.
This is involving javascript using react. The problem is to pass 2 variables of data from...
This question is based on react js. Please don't do it if you don't have thorough knowledge of React,node,mongodb, express.angular and vue.js. So i am designing an engineering dashboard with live api tracking system with frontend in react and backend in node js. You need to design a fully functional dashboard you can take any dummy database make apis test them and then add pagination in it. Please don't attempt it if you don;t have knowledge of rest api,react and...
This week we want to build an inheritance hierarchy using targets. You now need to take the Target class we have built and create a subclass that inherits from it. You can do whatever you want here, but it should be obvious how you changed the target. Some examples might include adding an additional ellipse to the target to increase the number of levels or changing up the colors. Once you have come up with one way to change the...
could you please help me with this problem, also I
need a little text so I can understand how you solved the
problem?
import java.io.File; import java.util.Scanner; /** *
This program lists the files in a directory specified by * the
user. The user is asked to type in a directory name. * If the name
entered by the user is not a directory, a * message is printed and
the program ends. */ public class DirectoryList { public static...