Can we use pure Bootstrap with React.js?

前端 未结 2 1071
故里飘歌
故里飘歌 2020-12-18 05:29

I would like to convert websites from PSD prototype to HTML/CSS/Bootstrap and then move on to JavaScript development and using React.js and some JavaScript coding.

I

相关标签:
2条回答
  • 2020-12-18 05:45

    In theory, yes. Since ReactComponent render themselves as html, you can just put the right css classes and there you go. That's totally fine for the css part of bootstrap.

    BUT, all the javascript stuff done by the bootstrap library that modify the DOM will be in "conflict" with the virtual DOM of React. One way to avoid that is to never rerender a react component for which its inner html is modified by bootstrap (by setting shouldComponentUpdate() { return false }). Doing this way, you can think of React as just a template library to generate some HTML markup, and letting bootstrap actively modify this markup for you but's it's not what React is made for.

    The whole point of React is the ability to see your UI as a function of your state : view = f(state) at any given moment. That's why react-bootstrap reimplements all DOM modifications in a React way.

    0 讨论(0)
  • 2020-12-18 05:55

    For sure you can. I will include the bootstrap css as a CDN and go with the normal development.

    0 讨论(0)
提交回复
热议问题