Tell us what’s happening:
- Below code is showing webpage with static text from Text component and button from Button component
- My question is
2.1 Is it valid to pass data from child component Button to parent component App ?
2.2 button click event will generate random number which will be sent to App, which later sends to Text component to show new text
2.3 Am I thinking correctly to implement solution here ?
2.4 I’m using only functional components here
Your code so far
import React from 'react';
import Text from './components/Text';
import Button from './components/Button';
function App() {
return (
<div id="quote-box">
<Text />
<Button />
</div>
);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36
.
Challenge: Build a Random Quote Machine
Link to the challenge: