Provider 사용하기

Context 를 프로젝트에 적용하려면, 여러분의 앱을 Provider 로 감싸주어야합니다. App.js 를 다음과 같이 수정하세요.

src/App.js

import React from 'react';
import LeftPane from './components/LeftPane';
import RightPane from './components/RightPane';
import { SampleProvider } from './contexts/sample';

const App = () => {
  return (
    <SampleProvider>
      <div className="panes">
        <LeftPane />
        <RightPane />
      </div>
    </SampleProvider>
  );
};

export default App;

Edit Context Tutorial

results matching ""

    No results matching ""