0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

React exportとimportの使い方

Posted at

Reactでのimportとexportの使い方をまとめていく。
恐らく最初に記載したものは間違いだらけだと思うので都度修正していけたらと思う。

exportの使い方はapp.js側では

import { Header } from './components/Header';

の表記が必要
header.js側では

export const Header = () => {
  return (
    
    </div>
  );
};

importの使い方はapp.js側では

import Header from './components/Header';

header.js側では

import React from 'react'

const Header = () => {
  return (
    <div>
      Header    
    </div>
  )
}

export default Header

で今のところは動いている。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?