[SOLVED] Cannot read properties of null (reading 'useContext') while installing react-bootstrap


import Button from 'react-bootstrap/Button';

function TypesExample() {

  return (


      <Button variant="primary">Primary</Button>{' '}

      <Button variant="secondary">Secondary</Button>{' '}

      <Button variant="success">Success</Button>{' '}

      <Button variant="warning">Warning</Button>{' '}

      <Button variant="danger">Danger</Button>{' '}

      <Button variant="info">Info</Button>{' '}

      <Button variant="light">Light</Button>{' '}

      <Button variant="dark">Dark</Button>

      <Button variant="link">Link</Button>




export default TypesExample;


import Buttoon from './Buttoon';

function App() {

  return (




export default App;

in index.js

import 'bootstrap/dist/css/bootstrap.min.css';  

in terminal,used npm command
npm install react-bootstrap bootstrap --save

Cannot read properties of null (reading ‘useContext’)
TypeError: Cannot read properties of null (reading ‘useContext’)

have not used hooks concept yet in this project. what is the issue here?

Hi @JuneD

It might be an error from the bootstrap sdk. Check the react-bootstrap docs on how to use it and check if you are missing something.

Hi,thanks for replying. Found out the mistake I made. Didn’t use cd project name cmd before installing bootstrap npm. This created multiple node_modules inside and outside the project. Hence the error.

1 Like