Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

面试纪要 #33

Open
hsipeng opened this issue Mar 8, 2018 · 0 comments
Open

面试纪要 #33

hsipeng opened this issue Mar 8, 2018 · 0 comments
Labels

Comments

@hsipeng
Copy link
Owner

hsipeng commented Mar 8, 2018

  • react 组件和 element 元素的区别?

element 元素
React 元素(React element),它是 React 中最小基本单位,我们可以使用 JSX 语法轻松地创建一个 React 元素。

组件是由元素构成的。元素数据结构是普通对象,而组件数据结构是类或纯函数。
详细➡️ React中元素与组件的区别 - React小黄书 - SegmentFault 思否

  • react 组件间通信有几种方式?

父组件向子组件通信:使用 props
子组件向父组件通信:使用 props 回调
跨级组件间通信:使用 context 对象
非嵌套组件间通信:使用事件订阅
React 中组件间通信的几种方式 - 简书

  • react 组件的生命周期,在哪个生命周期方法适合发起Ajxa

组件挂载完毕时即调用。生命周期内只会调用一次。
应用场景:通常可以将请求后端数据—— ajax/fetch 放在这里。此时界面上 DOM 已经存在。可以做有关 DOM 的操作。例如 findDOMNode.
Note: 在这里调用 setState 会进行一次额外的 rendering,虽然这会导致两次的 render, 但用户不会察觉这过度的时间。可能要多加考虑的地方是这会导致一定的性能问题。

理解 React 组件的生命周期 - Deadpool Front-end

  • store 是通过哪个方法更新的

组件通过dispatch 出发 action ,reducer 改变 store
深入浅出 - Redux · Issue #4 · berwin/Blog · GitHub

  • webpack 中配置按需加载主要通过什么方法实现?

webpack 按需打包加载 · Issue #8 · eyasliu/blog · GitHub

  • flex 布局
  • ES6

深入浅出ES6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant