Skip to content

Instantly share code, notes, and snippets.

@EmmanuelObua
Last active August 23, 2023 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EmmanuelObua/88018303e7b21b30c539fe9419787af1 to your computer and use it in GitHub Desktop.
Save EmmanuelObua/88018303e7b21b30c539fe9419787af1 to your computer and use it in GitHub Desktop.
import React, { useState, Fragment } from 'react';
import { Container, Row, Col } from 'react-bootstrap';
import { TaskProvider } from './components/TaskContext';
import { withTaskContext } from './components/withTaskContext';
import TaskList from './components/TaskList';
import TaskForm from './components/TaskForm';
function App() {
//The TaskList component is passed through a withTaskContext HOC that returns a component
// that can be rendered on a page
const TaskListWithHOC = withTaskContext(TaskList);
return (
<Container className="app-container">
<Fragment>
<div className="App">
<TaskProvider>
<Container>
<Row>
<Col>
<h5 className="text-center p-4">Task Management App</h5>
</Col>
</Row>
<Row>
<Col md={6}>
<TaskForm />
</Col>
<Col md={6}>
<h6>Task List</h6>
<TaskList />
<h6>Task List With HOC</h6>
<TaskListWithHOC/>
</Col>
</Row>
</Container>
</TaskProvider>
</div>
</Fragment>
</Container>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment