9/13 Why is there no need to import Talker.js

So there’s Button.js in exercise 9/13 and it just imports:

import React from 'react';

but we also modify the code to use {this.props.talk} for an onClick event.

Why don’t I have to import Talker.js where props.talk is defined?

Talker.js, however imports Button:

import { Button } from './Button';

I thought in order to use something you need to 1) export and 2nd) import it in each file?

we don’t need to, Talker will import Button first then Talker will be translated from JSX to JS code. Given Button element is now part of Talker,.js it has access to this.props

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.