не выводит массив на экран, в чем проблекма
index.js
import React from 'react';
import App from './App';
import ReactDOM from 'react-dom';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
App.js
import React, {useContext} from 'react';
import {Context} from './context';
import './App.css';
import Shop from './components/Shop';
var device= [
{name:'hello ', id:1},
{name:' world', id:2},
{name:'!!', id:3}
];
function App() {
return (
<Context.Provider value={{device}}>
<Shop/>
</Context.Provider>
);
}
export default App;
context.js
import React from 'react';
export const Context=React.createContext();
Shop.js
import React, {useContext} from 'react';
import {Context} from "../context";
//import Phone from './Phone';
function Shop() {
const {device} = useContext(Context)
return (
<div>
{device.map(device =>
<div class="hello">{device.name}</div>
)}
</div>
);
}
export default Shop;